code: def _camera_to_rays_fn(item, use_tf_camera=False):
      """Converts camera params to rays."""
      camera_params = item.pop("camera_params")
      if use_tf_camera:
          camera = tfcam.TFCamera(**camera_params)
          pixels = camera.get_pixel_centers()
          directions = camera.pixels_to_rays(pixels)
          origins = tf.broadcast_to(
              camera.position[None, None, :], tf.shape(directions)
          )
      else:
          camera = cam.Camera(**camera_params)
          pixels = camera.get_pixel_centers()
          directions = camera.pixels_to_rays(pixels)
          origins = np.broadcast_to(
              camera.position[None, None, :], directions.shape
          )
      item["origins"] = origins
      item["directions"] = directions
      item["pixels"] = pixels
      return item
  
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 6 for calling a global function with example usage: _camera_to_rays_fn(item, use_tf_camera) and returns: item