Solved by ptrblck in post #4 
              
              
                Thanks for the code. 
The error is thrown, because Normalize internally iterates the tensor channels, mean and std. 
Since you just have one value, you should pass it as: 
transforms.Normalize((0.5,), (0.5,))

Also, have a look at these mean and std estimates. They might work a bit better than 0.5, …