import tensorflow as tf

            gn_grads_, gn_grads_true_, v_grads_, v_grads_true_ = sess.run(
                [gn_grads, gn_grads_true, v_grads, v_grads_true])
            np.testing.assert_array_equal(gn_grads_, gn_grads_true_)
            np.testing.assert_array_equal(v_grads_, v_grads_true_)

    def test_get_train_op(self):
        """Tests get_train_op.
        """
        var = tf.Variable(0.)
        loss = tf.nn.l2_loss(var)
        train_op = opt.get_train_op(loss)
        self.assertTrue(tf.contrib.framework.is_tensor(train_op))

if __name__ == "__main__":
    tf.test.main()
