mxnet.gluon.data.DataLoader / RandomSampler shuffle

Dear all,

in the documentation of mxnet.gluon.data.DataLoader one of the options of this object is shuffle = True my question: does shuffling happen every time a new epoch starts automatically, or do I need to declare the object again to get a clean new shuffled order of input, labels?

Thank you very much in advance.

Hey @feevos,

It is shuffled every time you reach the end of your iterator.
See this simple test:

dataset = gluon.data.ArrayDataset(np.arange(5))
dataloader = gluon.data.DataLoader(dataset, batch_size=1, shuffle=True)

for data in dataloader:
    print(data.asscalar())
4
2
0
3
1

for data in dataloader:
    print(data.asscalar())
3
2
1
4
0
2 Likes

Thank you very much @ThomasDelteil, extremely appreciated.