docstr: Checks the correctness of the jacobian of energy.
docstr_tok: ["Checks","the","correctness","of","the","jacobian","of","energy","."]
code: def test_energy_jacobian_random(self):
      """Checks the correctness of the jacobian of energy."""
      number_vertices = np.random.randint(3, 10)
      batch_size = np.random.randint(3)
      batch_shape = np.random.randint(1, 10, size=(batch_size)).tolist()
      vertices_rest_pose_init = np.random.uniform(
          size=(number_vertices, 3)
      )
      vertices_deformed_pose_init = np.random.uniform(
          size=batch_shape + [number_vertices, 3]
      )
      quaternions_init = np.random.uniform(
          size=batch_shape + [number_vertices, 4]
      )
      num_edges = int(round(number_vertices / 2))
      edges = np.zeros(shape=(num_edges, 2), dtype=np.int32)
      edges[..., 0] = np.linspace(
          0, number_vertices / 2 - 1, num_edges, dtype=np.int32
      )
      edges[..., 1] = np.linspace(
          number_vertices / 2,
          number_vertices - 1,
          num_edges,
          dtype=np.int32,
      )
  
      def conformal_energy(
          vertices_rest_pose, vertices_deformed_pose, quaternions
      ):
          return as_conformal_as_possible.energy(
              vertices_rest_pose=vertices_rest_pose,
              vertices_deformed_pose=vertices_deformed_pose,
              quaternions=quaternions,
              edges=edges,
              conformal_energy=True,
          )
  
      def nonconformal_energy(
          vertices_rest_pose, vertices_deformed_pose, quaternions
      ):
          return as_conformal_as_possible.energy(
              vertices_rest_pose=vertices_rest_pose,
              vertices_deformed_pose=vertices_deformed_pose,
              quaternions=quaternions,
              edges=edges,
              conformal_energy=False,
          )
  
      with self.subTest(name="conformal"):
          self.assert_jacobian_is_correct_fn(
              conformal_energy,
              [
                  vertices_rest_pose_init,
                  vertices_deformed_pose_init,
                  quaternions_init,
              ],
          )
  
      with self.subTest(name="non_conformal"):
          self.assert_jacobian_is_correct_fn(
              nonconformal_energy,
              [
                  vertices_rest_pose_init,
                  vertices_deformed_pose_init,
                  quaternions_init,
              ],
          )
  
file_path: graphics/tensorflow_graphics/geometry/deformation_energy/tests/as_conformal_as_possible_test.py
imports: from absl.testing import flagsaver
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_graphics.geometry.deformation_energy import as_conformal_as_possible
  from tensorflow_graphics.geometry.transformation import quaternion
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 2 for calling the AsConformalAsPossibleTest obj's underlying member method code with example usage: obj.test_energy_jacobian_random() and returns: as_conformal_as_possible, as_conformal_as_possible