import tensorflow as tf

            sess.run(tf.global_variables_initializer())
            pc_lr_, pc_lr_true_, ned_lr_, ned_lr_true_ = sess.run(
                [pc_lr, pc_lr_true, ned_lr, ned_lr_true])
            self.assertEqual(pc_lr_, pc_lr_true_)
            self.assertEqual(ned_lr_, ned_lr_true_)

    def test_get_gradient_clip_fn(self):    # pylint: disable=too-many-locals
        """Tests get_gradient_clip_fn.
        """
        default_grad_clip_fn = opt.get_gradient_clip_fn(
            opt.default_optimization_hparams()["gradient_clip"])
        self.assertIsNone(default_grad_clip_fn)

        grads = [tf.random_uniform([10, 10], -1., 1.) for _ in range(5)]
        grads_and_vars = list(zip(grads, range(5)))

        hparams = {
            "type": "clip_by_global_norm",
            "kwargs": {
                "clip_norm": 0.1
            }
        }
        gn_grad_clip_fn = opt.get_gradient_clip_fn(hparams)
        gn_grads_and_vars = gn_grad_clip_fn(grads_and_vars)
        gn_grads, _ = zip(*gn_grads_and_vars)
        gn_grads_true, _ = tf.clip_by_global_norm(
