How to change/insert the shape of/into BatchDataset?

177 views
Skip to first unread message

Jeff Yang

unread,
Jun 30, 2019, 8:48:47 AM6/30/19
to Discuss
I'm replicating deep voice 3 paper from a github repo with TF 2.0.
I have done all preprocessing.
I have also created from tensor (shape is (13066,)) to TensorSliceDataset (shape is (None,)), mapped some functions and already batched it.
Now, I have BatchDataset which shape is (None, None).
**I have no idea how to change that (None, None) shape into desire shape (16, 180)?**

The repo is implemented with TF 1.3.
I am using TF 2.0.
When the old code is tf.train.batch and I head to the tensorflow website and found to use tf.data.Dataset in TF 2.0.
But, it doesn't have an option to shape the dataset.
Below is TF 1.3 code.

```
# TF old version
texts = tf.train.batch([text], shapes=[(hp.Tx,)],
                               num_threads=32,
                               batch_size=hp.batch_size,
                               capacity=hp.batch_size*32,   
                               dynamic_pad=False) # (16, 180)
# TF 2.0
texts = texts.batch(hp.batch_size) # (None, None)
```

The shape of BatchDataset before applying shape is (None, None).
The shape of BatchDataset after applying shape should be (16, 180).
I have asked in StackOverflow but no one answered my question.
Thank you!
Reply all
Reply to author
Forward
0 new messages