it’s trying to collate each single sample into a mini-batch Tensor, but it’s failing presumably because you are returning each sample of a different size (i.e. the height and width are prob. different between images in mini-batch).
The DataLoader allows you to pass a custom collate_fn in it’s constructor, so that you can choose how to put the mini-batch together, rather than the default behavior.
See this thread for more pointers Questions about Dataloader and Dataset