Issue
I have an array of shape (1, 6354944)
array([[ 9.15527344e-05, -6.10351562e-05, 6.10351562e-05, ...,
1.01928711e-02, 7.92236328e-02, -2.69470215e-02]])
And converted them to tensor slices
stream = tf.data.Dataset.from_tensor_slices(reshaped_data)
But when I batch them
seqs = stream.batch(1000, drop_remainder=True)
It returns
<BatchDataset shapes: (1000, 6354944), types: tf.float64>
When it’s supposed to have a shape of
(1000, 6354)
Solution
You can reshape your data before creating the dataset :
r = tf.reshape(a[ : , :6354000 ], (1000, 6354))
stream = tf.data.Dataset.from_tensor_slices(r)
seqs = stream.batch(1000) #(1000,6354)
Answered By – Tou You
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0