class_docstr: Adapter for Python generators.
code: def get_tf_dataset(self):
      from keras.utils.module_utils import tensorflow as tf
  
      def convert_to_tf(batch):
          if is_scipy_sparse(batch):
              batch = scipy_sparse_to_tf_sparse(batch)
          return batch
  
      def get_tf_iterator():
          for batch in self.generator:
              batch = tree.map_structure(convert_to_tf, batch)
              yield batch
  
      if self._output_signature is None:
          self._set_tf_output_signature()
      ds = tf.data.Dataset.from_generator(
          get_tf_iterator,
          output_signature=self._output_signature,
      )
      ds = ds.prefetch(tf.data.AUTOTUNE)
      return ds
  
file_path: keras/keras/trainers/data_adapters/generator_data_adapter.py
imports: import itertools
  import numpy
  import tree
  from keras.trainers.data_adapters.data_adapter import DataAdapter
label_desc: Use image node_id 4 for calling the GeneratorDataAdapter obj's underlying member method code with example usage: obj.get_tf_dataset() and returns: ds, batch