(self, loss, global_step=None)
return train_op
Get the training operator.
Get the training operator.
Get the training operator .
def get_train_op(self, loss, global_step=None):
    """Get the training operator."""
    apply_gradient_op = self.get_apply_gradients_op(loss, global_step)

    # model average
    self.var_avg(global_step)

    # model average after apply gradients
    with tf.control_dependencies([apply_gradient_op]):
      update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
      train_op = tf.group(*update_ops)

    utils.log_vars('moving vars', tf.moving_average_variables())
    return train_op
def get_train_op ( self , loss , global_step = None ) : apply_gradient_op = self . get_apply_gradients_op ( loss , global_step ) # model average self . var_avg ( global_step ) # model average after apply gradients with tf . control_dependencies ( [ apply_gradient_op ] ) : update_ops = tf . get_collection ( tf . GraphKeys . UPDATE_OPS ) train_op = tf . group ( * update_ops ) utils . log_vars ( 'moving vars' , tf . moving_average_variables ( ) ) return train_op