How can I Modify pytorch dataset __getitem__ function to return a bag of 10 images?

I don’t know how these 10 samples should be loaded, but in case you want to pass multiple indices from the sampler to the __getitem__ you could use a BatchSampler as described here.