Does seeding Random expected to seed DataLoader as well?

Hi all !

I seed mxnet using mx.random.seed(1).

Then I use:
dataset = gluon.data.vision.ImageFolderDataset(dataset_path, flag=0, transform=transform)
return gluon.data.DataLoader(dataset, batch_size, shuffle=True)

My expectation was the DataLoader to shuffle the same way every time I run my code.
Useful to have a ref test or for debugging purpose or for analysis (changing a parameter but not the batches)
Does not seem to be the case. In other words, data is reshuffled differently despite I seeded the Ramdom of MXNet.
Any work-around (other than shuffling the files on disk or shuffling the dataset myself)?

Thanks a lot,
AL

You probably want to make sure to seed numpy and builtin random as well.

import random
import numpy as np
import mxnet as mx

random.seed(1)
np.random.seed(1)
mx.random.seed(1)
1 Like

Damn I did not think about that… It s works great. Thank you very much !!