code: def camera_to_rays(camera: cam.Camera):
      """Converts a vision sfm camera into rays.
  
      Args:
        camera: the camera to convert to rays.
  
      Returns:
        A dictionary of rays. Contains:
          `origins`: the origin of each ray.
          `directions`: unit vectors representing the direction of each ray.
          `pixels`: the pixel centers of each ray.
      """
      camera = camera.copy()
  
      image_shape = camera.image_shape
  
      img_rays_origin = np.tile(
          camera.position[None, None, :], image_shape + (1,)
      )
      img_rays_dir = camera.pixels_to_rays(camera.get_pixel_centers())
      img_rays_pixels = camera.get_pixel_centers()
  
      return {
          "origins": img_rays_origin.astype(np.float32),
          "directions": img_rays_dir.astype(np.float32),
          "pixels": img_rays_pixels.astype(np.float32),
      }
  
imports: import abc
  import functools
  import itertools
  from typing import Any, Iterable, Optional, Sequence, Union
  from absl import logging
  from flax import jax_utils
  import jax
  import numpy
  import tensorflow
  from nerfies import camera
  from nerfies import gpath
  from nerfies import image_utils
  from nerfies import tf_camera
  from nerfies import utils
  from tensorflow.python.data.util import nest
label_desc: Use image node_id 1 for calling a global function with example usage: camera_to_rays(camera) and returns: dict