I have the following error in my input pipeline:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot batch tensors with different shape
What worked for me with tensorflow 2 :
1) setting the repeat() function when creating the dataset, therefore replacing
data = tf.data.Dataset.from_tensor_slices(x)
by
data = tf.data.Dataset.from_tensor_slices(x).repeat()
B) Passing the steps/epoch parameter to the fit method, therefore replacing
history = model.fit(dataset, epochs=EPOCHS, callbacks=[checkpoint_callback])
by
history = model.fit(dataset, epochs=EPOCHS, steps_per_epoch=data[0]/BUFFER_SIZE, callbacks=[checkpoint_callback])