Hey! I have a generator that yields TF datasets (of type MapDataset).
I’m trying to feed this generator into Kera’s fit method by:
fit(tf.data.Dataset.from_generator(name_of_gen, output_signature = ?)
How to determine the output signature of the MapDataset object? I’ve tried to get the signature using element_spec but feeding the result into the above doesn’t work…
What’s the correct approach to feeding a generator that outputs Dataset API objects into fit?
Hi @Ofek_Levy,
Welcome to the Tensorflow Forum!
tf.data.Dataset.from_generator() accepts the python generator (callable object) and returns an object that supports the iter()
protocol (e.g. a generator function). You need to define the output_types
or output_signature
based on the generator / object you are mentioning inside the Dataset.from_generator(). output_signature
consists shape and dtype of the mentioned object. Please refer to this link for more details.
Please share the reproducible code to replicate the error if the issue still persists. Thank you.