(self, loss, global_step=None)
return apply_gradient_op
Get Apply gradients operator.
Get Apply gradients operator.
Get Apply gradients operator .
def get_apply_gradients_op(self, loss, global_step=None):
    """Get Apply gradients operator."""
    opt = self.get_optimizer()
    grads_and_vars = opt.compute_gradients(loss)

    # clip gradient
    optconf = self.config['solver']['optimizer']
    global_norm = optconf['clip_global_norm']
    grads_and_vars = self.clip_gradients(grads_and_vars, global_norm)

    apply_gradient_op = opt.apply_gradients(
        grads_and_vars,
        global_step=global_step or tf.train.get_or_create_global_step())
    return apply_gradient_op
def get_apply_gradients_op ( self , loss , global_step = None ) : opt = self . get_optimizer ( ) grads_and_vars = opt . compute_gradients ( loss ) # clip gradient optconf = self . config [ 'solver' ] [ 'optimizer' ] global_norm = optconf [ 'clip_global_norm' ] grads_and_vars = self . clip_gradients ( grads_and_vars , global_norm ) apply_gradient_op = opt . apply_gradients ( grads_and_vars , global_step = global_step or tf . train . get_or_create_global_step ( ) ) return apply_gradient_op