import tensorflow as tf

    has_nan_or_inf, grad_scale, final_var_grads = task.ScaleGradients(var_grads)

    with self.session():
      tf.global_variables_initializer().run()
      self.assertTrue(has_nan_or_inf.eval())
      self.assertEqual(0., grad_scale.eval())
