@scopes.add_arg_scope
def global_step(device=''):
 global_step_ref = tf.get_collection(tf.GraphKeys.GLOBAL_STEP)
 if global_step_ref:
  return global_step_ref[0]
 else:
  collections = [VARIABLES_TO_RESTORE, tf.GraphKeys.GLOBAL_VARIABLES, tf.GraphKeys.GLOBAL_STEP]
  with tf.device(variable_device(device, 'global_step')):
   return tf.get_variable('global_step', shape=[], dtype=tf.int64, initializer=tf.zeros_initializer, trainable=False, collections=collections)

@ scopes . add_arg_scope def global_step ( device = '' ) : global_step_ref = tf . get_collection ( tf . GraphKeys . GLOBAL_STEP ) if global_step_ref : return global_step_ref [ 0 ] else : collections = [ VARIABLES_TO_RESTORE , tf . GraphKeys . GLOBAL_VARIABLES , tf . GraphKeys . GLOBAL_STEP ] with tf . device ( variable_device ( device , 'global_step' ) ) : return tf . get_variable ( 'global_step' , shape = [ ] , dtype = tf . int64 , initializer = tf . zeros_initializer , trainable = False , collections = collections )
returns the global step variable .