QBoard » Artificial Intelligence & ML » AI and ML - Tensorflow » What does tf.train.get_global_step() do in TensorFlow?

What does tf.train.get_global_step() do in TensorFlow?

  • What is the use of the function tf.train.get_global_step() in TensorFlow? In machine learning concepts what is it equivalent to?
      September 1, 2021 2:00 PM IST
    0
  • You could use it to restart training exactly where you left off when the training procedure has been stopped for some reason. Of course you can always restart training without knowing the global_step (if you save checkpoints regularly in your code, that is), but unless you somehow keep track of how many iterations you already performed, you will not know how many iterations are left after the restart. Sometimes you really want your model to be trained exactly n iterations and not n plus unknown amount before crash. So in my opinion, this is more of a practicality than a theoretical machine learning concept.
      September 3, 2021 5:28 PM IST
    0
  • tf.train.get_global_step() return global step(variable, tensor from variable node or None) through get_collection(tf.GraphKeys.GLOBAL_STEP) or get_tensor_by_name('global_step:0')

    global step is widely used in learn rate decay(like tf.train.exponential_decay, see Decaying the learning rate for more information).

    You can pass global step to optimzer apply_gradients or minimize method to increment by one.
      September 7, 2021 1:29 PM IST
    0
  • while you defined the global step operator, you can get value of it by sess.run(global_step_op)

     
      September 15, 2021 12:46 PM IST
    0