W3cubDocs

/TensorFlow Python

tf.train.global_step

tf.train.global_step(
    sess,
    global_step_tensor
)

Defined in tensorflow/python/training/training_util.py.

See the guide: Training > Training Utilities

Small helper to get the 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.
print('global_step: %s' % tf.train.global_step(sess, global_step_tensor))

global_step: 10

Args:

  • sess: A TensorFlow Session object.
  • global_step_tensor: Tensor or the name of the operation that contains the global step.

Returns:

The global step value.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/train/global_step