In my case, I had two versions of the code loading same data (differently stored). I expected the network to be the same but still the data was shuffled. However, the above hack worked if I re-seeded before the dataloader code. Not sure what was causing the issue but it worked.