I’m not sure I understand what you mean by



 GB_K:

and the loader will shuffle if it reaches to the end by enumerate.


but the data is already shuffled at the time you call enumerate() on the dataloader.
The dataloader first shuffles the data and puts it into batches. When you call enumerate(dataloader) you iterate over these shuffled batches.
The batches themselves get not shuffled by calling enumerate() but the data contained in these batches is shuffled by the dataloader (and also gets reshuffled every epoch according to the pytorch doc 6).