for the code snippet that you provided.
class MyDataset(torch.utils.Dataset):
    def __init__(self):
        self.data_files = os.listdir('data_dir')
        sort(self.data_files)

    def __getindex__(self, idx):
        return load_file(self.data_files[idx])

    def __len__(self):
        return len(self.data_files)

Are the file paths stored in self.data_files suppose to represent each batch of data (or data per loop) returned by iterating loader?