tf.assign_add

 

import tensorflow as tf



global_step = tf.Variable(1.0, dtype=tf.float64, trainable=False, name='global_step')
global_step_update = tf.assign_add(global_step, 1.0)
sess=tf.Session()
sess.run(tf.global_variables_initializer())
for i in range(4):
a=sess.run(global_step)
print('global_step=',a)
b=sess.run(global_step_update)
print('global_rate=',b)

 

 

 

 

posted @ 2019-10-29 11:29  tangjunjun  阅读(532)  评论(0编辑  收藏  举报
https://rpc.cnblogs.com/metaweblog/tangjunjun