'Gradient ops.'

def training_ops(self, loss, learning_rate=None):

    opt = self.get_optimizer(learning_rate)
    params = tf.trainable_variables()
    grads = tf.gradients(loss, params)
    if self.clip_norm:
        (grads, global_norm) = tf.clip_by_global_norm(grads, self.clip_norm)
        tf.summary.scalar('grad_global_norm', global_norm)
    return opt.apply_gradients(zip(grads, params))
