class_docstr: Adapter for Python generators.
code: def __init__(self, generator):
      data, generator = peek_and_restore(generator)
      self.generator = generator
      self._output_signature = None
      if not isinstance(data, tuple):
          raise ValueError(
              "When passing a Python generator to a Keras model, "
              "the generator must return a tuple, either "
              "(input,) or (inputs, targets) or "
              "(inputs, targets, sample_weights). "
              f"Received: {data}"
          )
  
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 1 to create a new GeneratorDataAdapter object from inherited base classes: DataAdapter with example: obj = GeneratorDataAdapter(generator)