Not sure how to formulate the question to search whether it has been already asked.
So I have a DataLoader that is also shuffled, so for each batch of size batch_size, I want a index/tensor of length batch_size containing the indices the samples have had in the original dataset.
So if for example batch_size=2 the DataLoader randomly chose the 100th and 420th sample of the dataset, the batch should instead be a 2-tuple of (index_or_tensor(100,420), tensor(sample_100,sample_420)).