class_docstr: Test case class implementing extra test functionalities.
class_docstr_tok: ["Test","case","class","implementing","extra","test","functionalities","."]
docstr: Tests that the Jacobian only contains valid values.
  
  The analytical gradients and numerical ones are expected to differ at points
  where f(x) is not smooth. This function can be used to check that the
  analytical gradient is not 'NaN' nor 'Inf'.
  
  Args:
    f: the function.
    x: A list of arguments for the function
docstr_tok: ["Tests","that","the","Jacobian","only","contains","valid","values",".","The","analytical","gradients","and","numerical","ones","are","expected","to","differ","at","points","where","f","(","x",")","is","not","smooth",".","This","function","can","be","used","to","check","that","the","analytical","gradient","is","not","'NaN","'","nor","'Inf","'",".","Args",":","f",":","the","function",".","x",":","A","list","of","arguments","for","the","function"]
code: def assert_jacobian_is_finite_fn(self, f, x):
      """Tests that the Jacobian only contains valid values.
  
      The analytical gradients and numerical ones are expected to differ at points
      where f(x) is not smooth. This function can be used to check that the
      analytical gradient is not 'NaN' nor 'Inf'.
  
      Args:
        f: the function.
        x: A list of arguments for the function
      """
      if tf.executing_eagerly():
          theoretical_gradient, _ = tf.test.compute_gradient(f, x)
      else:
          with self.cached_session():
              theoretical_gradient, _ = tf.test.compute_gradient(f, x)
      self.assertNotIn(
          True,
          [
              np.isnan(element).any() or np.isinf(element).any()
              for element in theoretical_gradient
          ],
          msg="nan or inf elements found in theoretical jacobian.",
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import warnings
  from absl import flags
  from absl.testing import parameterized
  import numpy
  from six.moves import zip
  import tensorflow
  from tensorflow_graphics.util import tfg_flags
label_desc: Use image node_id 11 for calling the TestCase obj's underlying member method code with example usage: obj.assert_jacobian_is_finite_fn(f, x) without return types