class_docstr: An abstract class that defines a data source.
class_docstr_tok: ["An","abstract","class","that","defines","a","data","source","."]
docstr: Creates a tf.data.Dataset from a list of cameras.
code: def create_cameras_dataset(
      self,
      cameras: Union[Iterable[tfcam.TFCamera], Iterable[gpath.GPath]],
      flatten=False,
      shuffle=False,
  ):
      """Creates a tf.data.Dataset from a list of cameras."""
      if isinstance(cameras[0], gpath.GPath) or isinstance(
          cameras[0], str
      ):
          cameras = utils.parallel_map(self.load_camera, cameras)
  
      def _generator():
          for camera in cameras:
              yield {"camera_params": camera.get_parameters()}
  
      dataset = tf.data.Dataset.from_generator(
          _generator,
          output_signature={
              "camera_params": _TF_CAMERA_PARAMS_SIGNATURE
          },
      )
      dataset = dataset.map(
          functools.partial(_camera_to_rays_fn, use_tf_camera=True),
          _TF_AUTOTUNE,
      )
  
      if flatten:
          # Unbatch images to rows.
          dataset = dataset.unbatch()
          if shuffle:
              dataset = dataset.shuffle(20000)
          # Unbatch rows to rays.
          dataset = dataset.unbatch()
          if shuffle:
              dataset = dataset.shuffle(20000)
  
      return dataset
  
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 23 for calling the DataSource obj's underlying member method code with example usage: obj.create_cameras_dataset(cameras, flatten, shuffle) and returns: dataset