It’s just a debugging step to see the shapes of your data.
The error seems to be thrown, since the spatial size of your image tensors differ, although you are using Resize in your transformation.
If you run the code with batch_size=1, you could print the shape using:
for data, target in loader:
    print(data.shape)

so that we can debug this issue further.