Solved by ptrblck in post #2 
              
              
                img will have 3 dimensions ([1, 28, 28]), which will yield this error. 
The reason for the additional channel dimension is, that each sample will already be transformed in the super().__getitem__() method. 
In particular Normalize will add the channel dimension, if you pass the MNIST images to this …