I’m not sure what your use case is.
ImageFolder will create the target based on the subfolders which are in the specified root folder.
You could use these targets to select if the current data samples based on their class.
If you don’t shuffle the DataLoader, you’ll get the samples in the order your dataset contains them.
Could you explain a bit what you are trying to do with these samples?
Maybe there is another (better) solution.