'Clips gradients by global norm.'

def _clip_gradients(self, grads_and_vars):

    (gradients, variables) = zip(*grads_and_vars)
    (clipped_gradients, _) = tf.clip_by_global_norm(gradients, self.params[u'optimizer.clip_gradients'])
    return list(zip(clipped_gradients, variables))
