I am making dataloaders of a dataset of 10560 images, of them 1000 are for test, and the bigger part is divided into train and val in 85:15 ratio.
Batchsize is 100
The code is:
class CustomDataset(Dataset):
    def __init__(self, samples, transform = None):
        self.transform = transform
        self.samples = samples

    def __getitem__(self, index):
        s1, s2, t = self.samples[index]
        s1 = imread(os.path.join(current_path, string, s1))
        s2 = imread(os.path.join(current_path, string, s2))
        s1 = gray2rgb(s1)
        s2 = gray2rgb(s2)

        if self.transform:
            s1 = self.transform(s1)
            s2 = self.transform(s2)

        t = torch.tensor(t)
        return (s1, s2, t)

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


train_dataset = CustomDataset(trainlist, transform=transform)
test_dataset = CustomDataset(testlist, transform=transform)

train_dataloader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=4, drop_last=False)
test_dataloader = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=4, drop_last=False)

And I am just trying
for e, (inputs1, inputs2, labels) in enumerate(train_dataloader):
    print(e)

to test the code. But I am getting this error:
ValueError: only one element tensors can be converted to Python scalars

I must say, before this, I was working with a similar but smaller dataset and the code was same. There I wasn’t getting this error.
Can anyone help?