I’m trying to generate a tensor from a dataset of the following format:
[
([[101, 4640, 8684, 2443, 3874, 5772, 6388, 1280, 102], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]], 1),
([[101, 4102, 293, 3718, 249, 598, 5772, 6388, 1280, 102], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 0),
([[101, 169, 1382, 2534, 5772, 6388, 1280, 5457, 20073, 102], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 0)
,....
all_dataset = tf.data.Dataset.from_generator(lambda: sorted_all,
output_types=(tf.int32, tf.int32))
My all_dataset has the following format
<_FlatMapDataset element_spec=(TensorSpec(shape=<unknown>, dtype=tf.int32, name=None), TensorSpec(shape=<unknown>, dtype=tf.int32, name=None))>
And I need to pass this all_dataset to a function in the sequence
all_batched = all_dataset.padded_batch(BATCH_SIZE,
padded_shapes=((3, None), ()),
padding_values=(0, 0))
all_batched in turn returns a tensor with None which breaks my application.
<_PaddedBatchDataset element_spec=(TensorSpec(shape=(None, 3, None), dtype=tf.int32, name=None), TensorSpec(shape=(None,), dtype=tf.int32, name=None))>
I’m using tensorflow in Version: 2.12.1. And downgrading to previous versions is not an option in this project. Does anyone have a viable solution for this case?