code: def camera_rays_from_extrinsics(
      rays, rotation_matrix, translation_vector
  ):
      """Transform the rays from a camera located at (0, 0, 0) to ray origins and directions for a camera with given extrinsics.
  
      Args:
        rays: A tensor of shape `[A1, ..., An, N, 3]` where N is the number of rays.
        rotation_matrix: A tensor of shape `[A1, ..., An, 3, 3]`.
        translation_vector: A tensor of shape `[A1, ..., An, 3, 1]`.
      Returns:
        A tensor of shape `[A1, ..., An, N, 3]` representing the ray origin and
        a tensor of shape `[A1, ..., An, N, 3]` representing the ray direction.
      """
      shape.check_static(
          tensor=rays, tensor_name="pixels", has_rank_greater_than=1
      )
      shape.compare_batch_dimensions(
          tensors=(rays, rotation_matrix, translation_vector),
          tensor_names=(
              "points_on_rays",
              "rotation_matrix",
              "translation_vector",
          ),
          last_axes=-3,
          broadcast_compatible=False,
      )
  
      rays_org = _move_in_front_of_camera(
          tf.zeros_like(rays), rotation_matrix, translation_vector
      )
      rays_dir_ = _move_in_front_of_camera(
          rays, rotation_matrix, 0 * translation_vector
      )
      rays_dir = rays_dir_ / tf.norm(rays_dir_, axis=-1, keepdims=True)
      return rays_org, rays_dir
  
file_path: graphics/tensorflow_graphics/projects/radiance_fields/utils.py
imports: import math
  import tensorflow
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
  from tensorflow_graphics.util import shape
label_desc: Use image node_id 5 for calling a global function with example usage: camera_rays_from_extrinsics(rays, rotation_matrix, translation_vector) and returns: rays_org,  rays_dir