Pytorch常见问题(一):MNIST集output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]
主要原因:MNIST集中的图片为灰度图片,只有一个通道,而transform=transforms.Compose([transforms.ToTensor(),transforms.Normalize(mean=(0.5,0.5,0.5),std=(0.5,0.5,0.5))])代码中mean=(0.5,0.5,0.5)则为三个通道的均值,故不匹配。【但是大多数学习Pytorch的书里代码都是这