Sequential model with tensorflow dataset

When using a generator, Keras models expect a input with a batch dimension as their first dimension.

Simply call batch(batch_size) on your dataset :

batch_size = 1
train_dataset = tf.data.Dataset.from_tensor_slices((X_train_set, y_train_set))
train_dataset = train_dataset.batch(batch_size)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top