docstr: Tests the Jacobian of perspective_correct_barycentrics.
docstr_tok: ["Tests","the","Jacobian","of","perspective_correct_barycentrics","."]
code: def test_perspective_correct_barycentrics_jacobian_random(self):
      """Tests the Jacobian of perspective_correct_barycentrics."""
      tensor_size = np.random.randint(1, 3)
      tensor_shape = np.random.randint(
          1, 5, size=(tensor_size)
      ).tolist()
      vertices_init = np.random.uniform(size=tensor_shape + [3, 3])
      pixel_position_init = np.random.uniform(size=tensor_shape + [2])
      camera_position_init = np.random.uniform(
          size=tensor_shape + [3, 3]
      )
      look_at_init = np.random.uniform(size=tensor_shape + [3, 3])
      up_vector_init = np.random.uniform(size=tensor_shape + [3, 3])
      vertical_field_of_view_init = np.random.uniform(
          0.1, 1.0, size=tensor_shape + [3, 1]
      )
      screen_dimensions_init = np.random.uniform(
          1.0, 10.0, size=tensor_shape + [3, 2]
      )
      near_init = np.random.uniform(
          1.0, 10.0, size=tensor_shape + [3, 1]
      )
      far_init = near_init + np.random.uniform(
          0.1, 1.0, size=tensor_shape + [3, 1]
      )
      lower_left_corner_init = np.random.uniform(
          size=tensor_shape + [3, 2]
      )
  
      # Build matrices.
      model_to_eye_matrix_init = look_at.right_handed(
          camera_position_init, look_at_init, up_vector_init
      )
      perspective_matrix_init = perspective.right_handed(
          vertical_field_of_view_init,
          screen_dimensions_init[..., 0:1]
          / screen_dimensions_init[..., 1:2],
          near_init,
          far_init,
      )
  
      self.assert_jacobian_is_correct_fn(
          glm.perspective_correct_barycentrics,
          [
              vertices_init,
              pixel_position_init,
              model_to_eye_matrix_init,
              perspective_matrix_init,
              screen_dimensions_init,
              lower_left_corner_init,
          ],
          atol=1e-4,
      )
  
imports: import math
  from absl.testing import flagsaver
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_graphics.geometry.transformation import look_at
  from tensorflow_graphics.rendering.camera import perspective
  from tensorflow_graphics.rendering.opengl import math
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 35 for calling the MathTest obj's underlying member method code with example usage: obj.test_perspective_correct_barycentrics_jacobian_random() without return types