Hi,
I am trying to use a Subset random Sampler in my data-loading flow. But I am getting
 "TypeError: list indices must be integers or slices, not tuple".
Without using Subset Random Sampler my code is working fine.
I am using a custom dataset class and below is the __getitem__ function, it returns a tuple, but it is a standard way taken from pytorch tutorials.
Where I am doing wrong as I am not violating the default return of the function?
How to fix it?
def __getitem__(self, index):
    """Generate one sample of data."""
    ID = self.list_IDs[index]
    image = Image.open(os.path.join(self.dir, ID))
    y = self.labels[ID]
    if self.train_transform:
        image = self.train_transforms(image)
    elif self.valid_transform:
        image = self.valid_transforms(image)
    else:
        image = self.test_transforms(image)
    img = np.array(image)
    return img, y

My data loading pipeline -
training_set = Dataset(partition['train_set'], labels, root_dir='path', train_transform=True) # noqa
train_sampler = SubsetRandomSampler(training_set)
train_loader = torch.utils.data.DataLoader(training_set, shuffle=False, sampler=train_sampler,pin_memory=True, num_workers=0, batch_size=batch_size,) # noqa