docstr: Checks that energy returns the expected value.
docstr_tok: ["Checks","that","energy","returns","the","expected","value","."]
code: def test_energy_preset(self):
      """Checks that energy returns the expected value."""
      vertices_rest_pose = np.array(((1.0, 0.0, 0.0), (-1.0, 0.0, 0.0)))
      vertices_deformed_pose = 2.0 * vertices_rest_pose
      quaternions = quaternion.from_euler(
          np.zeros(shape=vertices_deformed_pose.shape)
      )
      edges = ((0, 1),)
  
      all_weights_1_energy = as_conformal_as_possible.energy(
          vertices_rest_pose, vertices_deformed_pose, quaternions, edges
      )
      all_weights_1_gt = 4.0
      vertex_weights = np.array((2.0, 1.0))
      vertex_weights_energy = as_conformal_as_possible.energy(
          vertices_rest_pose=vertices_rest_pose,
          vertices_deformed_pose=vertices_deformed_pose,
          quaternions=quaternions,
          edges=edges,
          vertex_weight=vertex_weights,
      )
      vertex_weights_gt = 10.0
      edge_weights = np.array((2.0,))
      edge_weights_energy = as_conformal_as_possible.energy(
          vertices_rest_pose=vertices_rest_pose,
          vertices_deformed_pose=vertices_deformed_pose,
          quaternions=quaternions,
          edges=edges,
          edge_weight=edge_weights,
      )
      edge_weights_gt = 16.0
  
      with self.subTest(name="all_weights_1"):
          self.assertAllClose(all_weights_1_energy, all_weights_1_gt)
      with self.subTest(name="vertex_weights"):
          self.assertAllClose(vertex_weights_energy, vertex_weights_gt)
      with self.subTest(name="edge_weights"):
          self.assertAllClose(edge_weights_energy, edge_weights_gt)
  
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 4 for calling the AsConformalAsPossibleTest obj's underlying member method code with example usage: obj.test_energy_preset() without return types