2024-05-15 11:30:01 发布
网友
我在Torchvision中使用MNIST数据集时遇到以下错误
RuntimeError: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]
这是我的代码:
错误是由于数据集上的颜色与灰度有关,数据集为灰度。在
我通过将转换更改为
transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5,), (0.5,)) ])
错误是由于数据集上的颜色与灰度有关,数据集为灰度。在
我通过将转换更改为
相关问题 更多 >
编程相关推荐