code: def perspective_correct_barycentrics(
      triangle_vertices_model_space: type_alias.TensorLike,
      pixel_position: type_alias.TensorLike,
      model_to_eye_matrix: type_alias.TensorLike,
      perspective_matrix: type_alias.TensorLike,
      screen_dimensions: type_alias.TensorLike,
      lower_left_corner: type_alias.TensorLike = (0.0, 0.0),
      name: str = "perspective_correct_barycentrics",
  ) -> tf.Tensor:
      """Computes perspective correct barycentrics.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        triangle_vertices_model_space: A tensor of shape `[A1, ..., An, 3, 3]`,
          where the last dimension represents the vertices of a triangle in model
          space.
        pixel_position: A tensor of shape `[A1, ..., An, 2]`, where the last
          dimension stores the position (in pixels) where the interpolation is
          requested.
        model_to_eye_matrix: A tensor of shape `[A1, ..., An, 4, 4]`, where the last
          two dimension represent matrices to transform points from model to eye
          coordinates.
        perspective_matrix: A tensor of shape `[A1, ..., An, 4, 4]`, where the last
          two dimension represent matrices to transform points from eye to clip
          coordinates.
        screen_dimensions: A tensor of shape `[A1, ..., An, 2]`, where the last
          dimension is expressed in pixels and captures the width and the height (in
          pixels) of the screen.
        lower_left_corner: A tensor of shape `[A1, ..., An, 2]`, where the last
          dimension captures the position (in pixels) of the lower left corner of
          the screen.
        name: A name for this op. Defaults to "perspective_correct_barycentrics".
  
      Raises:
        InvalidArgumentError: if any input contains data not in the specified range
          of valid values.
        ValueError: If any input is of an unsupported shape.
  
      Returns:
        A tensor of shape `[A1, ..., An, 3]`, containing perspective correct
        barycentric coordinates.
      """
      with tf.name_scope(name):
          pixel_position = tf.convert_to_tensor(value=pixel_position)
          triangle_vertices_model_space = tf.convert_to_tensor(
              value=triangle_vertices_model_space
          )
          shape.check_static(
              tensor=pixel_position,
              tensor_name="pixel_position",
              has_dim_equals=(-1, 2),
          )
          shape.check_static(
              tensor=triangle_vertices_model_space,
              tensor_name="triangle_vertices_model_space",
              has_dim_equals=((-2, 3), (-1, 3)),
          )
  
          lower_left_corner = tf.convert_to_tensor(
              value=lower_left_corner
          )
          screen_dimensions = tf.convert_to_tensor(
              value=screen_dimensions
          )
          lower_left_corner = shape.add_batch_dimensions(
              lower_left_corner,
              "lower_left_corner",
              model_to_eye_matrix.shape[:-2],
              last_axis=-2,
          )
          screen_dimensions = shape.add_batch_dimensions(
              screen_dimensions,
              "screen_dimensions",
              model_to_eye_matrix.shape[:-2],
              last_axis=-2,
          )
  
          vertices_screen, vertices_w = model_to_screen(
              triangle_vertices_model_space,
              model_to_eye_matrix,
              perspective_matrix,
              screen_dimensions,
              lower_left_corner,
          )
          vertices_w = tf.squeeze(vertices_w, axis=-1)
          pixel_position = tf.expand_dims(pixel_position, axis=-2)
          (
              barycentric_coordinates,
              _,
          ) = weighted.get_barycentric_coordinates(
              vertices_screen[..., :2], pixel_position
          )
          barycentric_coordinates = tf.squeeze(
              barycentric_coordinates, axis=-2
          )
          coeffs = barycentric_coordinates / vertices_w
          return tf.linalg.normalize(coeffs, ord=1, axis=-1)[0]
  
file_path: graphics/tensorflow_graphics/rendering/opengl/math.py
imports: from typing import Tuple
  import tensorflow
  from tensorflow_graphics.geometry.transformation import look_at
  from tensorflow_graphics.math.interpolation import weighted
  from tensorflow_graphics.rendering.camera import perspective
  from tensorflow_graphics.util import asserts
  from tensorflow_graphics.util import export_api
  from tensorflow_graphics.util import shape
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 6 for calling a global function with example usage: perspective_correct_barycentrics(triangle_vertices_model_space, pixel_position, model_to_eye_matrix, perspective_matrix, screen_dimensions, lower_left_corner, name) and returns: tf