import tensorflow as tf


    FLAGS.enable_check_numerics = False
    with self.session():
      tf.global_variables_initializer().run()
      self.assertFalse(has_nan_or_inf.eval())
      self.assertEqual(1.0, grad_scale.eval())
      # The final gradient must be finite.
      self.assertFalse(tf.is_nan(final_var_grads.a[1]).eval())
      self.assertTrue(tf.is_finite(final_var_grads.a[1]).eval())

  def testScaleGradientsInf(self):
    FLAGS.enable_check_numerics = False
    p = self.TestParams()
    p.input = base_input_generator.BaseSequenceInputGenerator.Params()
