diff options
Diffstat (limited to 'tensorflow/python/training/training_util.py')
-rw-r--r-- | tensorflow/python/training/training_util.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tensorflow/python/training/training_util.py b/tensorflow/python/training/training_util.py index 0877b2a8a2..2ff3eeb153 100644 --- a/tensorflow/python/training/training_util.py +++ b/tensorflow/python/training/training_util.py @@ -44,11 +44,13 @@ def global_step(sess, global_step_tensor): """Small helper to get the global step. ```python - # Creates a variable to hold the global_step. + # Create a variable to hold the global_step. global_step_tensor = tf.Variable(10, trainable=False, name='global_step') - # Creates a session. + # Create a session. sess = tf.Session() - # Initializes the variable. + # Initialize the variable + sess.run(global_step_tensor.initializer) + # Get the variable value. print('global_step: %s' % tf.train.global_step(sess, global_step_tensor)) global_step: 10 |