Reputation: 21
I can't find out how the function of shuffle in tf.dataset work. I try to see output to guess what happen inside.
dataset = tf.data.Dataset.range(6);
dataset = dataset.shuffle(buffer_size =1).batch(6)
for item in dataset:
print(item)
Output:
tf.Tensor([0 1 2 3 4 5], shape=(6,), dtype=int64)
===> As you see, the shuffle doesn't work when buffer_size =1 But when I change buffer_size = 2 the list change the order but the first item only in 0 or 1 although I run 100 time again.
Anyone in group can explain the role of buffer_size. I read the document of tensorflow at https://www.tensorflow.org/api_docs/python/tf/data/Dataset#shuffle
In my thought, when set buffer_size = 1, as document said, maybe i can replace element in buffer_size. But the output I get make me confused.
can anyone run into the same problem ?
Upvotes: 1
Views: 312
Reputation: 21
now i completely find out the problem.
I can explain step by step in my case:
Upvotes: 1