Does seeding Random expected to seed DataLoader as well?


Hi all !

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

Then I use:
dataset =, flag=0, transform=transform)
return, 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,


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

import random
import numpy as np
import mxnet as mx



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