Thank you again. Basically, whenever I try to iterate the DataLoader object, I get this error. Following code reproduce the issue -
train_transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor()
])
train_dataset = CustomDataset(x_train, y_train, transform=train_transform)
test_dataset = CustomDataset(x_test, y_test, transform=train_transform)
train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=False)
test_loader = DataLoader(test_dataset, batch_size=batch_size, shuffle=False)
dataloader_iterator = iter(train_loader)
 images, labels = dataloader_iterator.next() // the error throws as soon as this line execute