Could you check the output of your Dataset?
Based on the example code in this thread it looks like two values should be returned, but I’m not sure how your current implementation works.
Just print the length of the returned values:
len(train_dataset[0])

You could get the size of the Dataset using this code snippet:
len(dataloaders[phase].dataset)

Also, as you can see, I’ve changed the name from DataLoader to dataloaders, since DataLoader is used by PyTorch and I don’t want to accidentally mask it somehow.