My network with take arrays of shape [X, 2000, 1], where X is variable (not batch size).
I can fit my model with input sizes of first [500,2000,1] and then [800,2000,1] consecutively and I get no errors. However, I am trying to combine the training data into one dataset so I would have a dataset with 2 batches [2, Variable, 2000, 1].
To do this I am using the following code,
batch1 = tf.RaggedTensor.from_row_splits(
values=tf.random.normal([500, 2000,1]),
row_splits=[0, 500]
)
batch2 = tf.RaggedTensor.from_row_splits(
values=tf.random.normal([800, 2000,1]),
row_splits=[0, 800]
)
Concatenate the ragged tensors
combined_data = tf.concat([batch1, batch2], axis=0)
labels =[Y1, Y2]
Create a dataset from the combined data and labels
dataset = tf.data.Dataset.from_tensor_slices((combined_data, labels))
However I get an error when training the model using this dataset as it says it expects a input size of (None, None, 2000, 1), but it is receiving (None, 2000, 1).
It is unclear why there is a reduction in the shape of the input when I take the first data of the dataset using dataset.take(1) I get the expected shape.
Any idea?