Solved by ptrblck in post #2 
              
              
                I think the BatchSampler will make sure to pass all batch indices to your Dataset's __getitem__ method as seen in this example: 
class MyDataset(Dataset):
    def __init__(self):
        self.data = torch.arange(100).view(100, 1).float()
        
    def __getitem__(self, index):
        print(index…