Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does global_step mean in Tensorflow?

In this is tutorial code from TensorFlow website,

  1. could anyone help explain what does global_step mean?

    I found on the Tensorflow website written that global step is used count training steps, but I don't quite get what exactly it means.

  2. Also, what does the number 0 mean when setting up global_step?

    def training(loss,learning_rate):         tf.summary.scalar('loss',loss)         optimizer = tf.train.GradientDescentOptimizer(learning_rate)                  # Why 0 as the first parameter of the global_step tf.Variable?         global_step = tf.Variable(0, name='global_step',trainable=False)          train_op = optimizer.minimize(loss, global_step=global_step)              return train_op 

According to Tensorflow doc global_step: increment by one after the variables have been updated. Does that mean after one update global_step becomes 1?

like image 995
GabrielChu Avatar asked Dec 15 '16 14:12

GabrielChu


People also ask

What is the use of global steps in TensorFlow?

to build on Wei Liu's answer, global steps are also useful for tracking progress of distributed TensorFlow jobs. As workers concurrently see batches, there needs to be a mechanism to track the total number of batches seen.

How to get the global step value in TF?

You can get the global_step value using tf.train.global_step(). Also handy are the utility methods tf.train.get_global_step or tf.train.get_or_create_global_step. 0 is the initial value of the global step in this context.

What is global step and global step loss?

what is global step and loss? · Issue #2980 · tensorflow/models · GitHub global_step is the iteration (so global_step 50 means we're processing the 50th batch). global step/sec and sec/step represent the same thing (one is the inverse of the other). Correct. loss represents the sum of localization and classification losses.

What is the global_step variable?

The global_step Variable holds the total number of steps during training across the tasks (each step index will occur only on a single task).


1 Answers

global_step refers to the number of batches seen by the graph. Every time a batch is provided, the weights are updated in the direction that minimizes the loss. global_step just keeps track of the number of batches seen so far. When it is passed in the minimize() argument list, the variable is increased by one. Have a look at optimizer.minimize().

You can get the global_step value using tf.train.global_step(). Also handy are the utility methods tf.train.get_global_step or tf.train.get_or_create_global_step.

0 is the initial value of the global step in this context.

like image 134
martianwars Avatar answered Oct 09 '22 17:10

martianwars