tf.train.global_step(sess, global_step_tensor)
返回global_step的值
# Creates a variable to hold the global_step.
global_step_tensor = tf.Variable(10, trainable=False, name='global_step')
# Creates a session.
sess = tf.Session()
# Initializes the variable.
sess.run(global_step_tensor.initializer)
print 'global_step:', tf.train.global_step(sess, global_step_tensor)
global_step: 10
Args:
sess: A brain Session object.
global_step_tensor: Tensor or the name of the operation that contains the global step.
本文详细介绍了在TensorFlow中如何创建和使用全局步数变量,通过实例演示了如何在session中初始化并获取全局步数的值,这对于理解训练过程中的迭代次数至关重要。
462

被折叠的 条评论
为什么被折叠?



