L1aoXingyu / pytorch-beginner

pytorch tutorial for beginners
2.99k stars 1.09k forks source link

Error for MNIST autoEncoder #27

Open ir1979 opened 5 years ago

ir1979 commented 5 years ago

Your file produces Error: RuntimeError: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]

It probably due to the gray-scale image downloaded automatically.

thunfischtoast commented 5 years ago

The normalize-operation in the transform expects 3 channels. For a gray-scale image with 1 channel change

transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))

to

transforms.Normalize((0.5,), (0.5,))

Postroggy commented 2 years ago

Lol,the Conv_autoencoder python code is way too too simply and way toto crude