For training an LSTM model in Tensorflow, I have structured my data into a tf.train.SequenceExample format and stored it i
If your current Dataset object contains a tuple, you can also to specify the shape of each padded element.
For example, I have a (same_sized_images, Labels) dataset and each label has different length but same rank.
def process_label(resized_img, label):
# Perfrom some tensor transformations
# ......
return resized_img, label
dataset = dataset.map(process_label)
dataset = dataset.padded_batch(batch_size,
padded_shapes=([None, None, 3],
[None, None])) # my label has rank 2