Hello, I have this dataset maker and I get a similar issue. I tried what you suggested but I get this error:
 return data[:3], target[:3], index
IndexError: invalid index to scalar variable.

Do you know why it is a scalar instead of a tensor?
class MyDataset(Dataset):
    def __init__(self,remove_list):
        self.cifar10 = datasets.CIFAR10(root='./data',

                                        download=False,
                                        train=True,
                                        transform=transform)
        self.data = self.cifar10.data
        # self.data = np.vstack(self.data).reshape(-1, 3, 32, 32)
        # self.data = self.data.transpose((0, 2, 3, 1))
        self.targets = self.cifar10.targets
        self.final_data, self.final_targets = self.__remove__(remove_list)
      
    def __getitem__(self, index):
        data, target = self.final_data[index], self.final_targets[index]
        
        return data[:3], target[:3], index

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

    def __remove__(self, remove_list):
        data = np.delete(self.data, remove_list, axis=0)        
        targets = np.delete(self.targets, remove_list, axis=0)
        
        return data, targets