Tensorflow: tf.data.Dataset, Cannot batch tensors with different shapes in component 0
问题 I have the following error in my input pipeline: tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot batch tensors with different shapes in component 0. First element had shape [2,48,48,3] and element 1 had shape [27,48,48,3]. with this code dataset = tf.data.Dataset.from_generator(generator, (tf.float32, tf.int64, tf.int64, tf.float32, tf.int64, tf.float32)) dataset = dataset.batch(max_buffer_size) This is completely logical as the batch method tries to create a (batch_size,