dataTtransform = transforms.Compose([
transforms.ToTensor(),
transforms.Resize([imageSize, imageSize]),
])
在定义transforms.Compose()时,把ToTensor()方法写在了Resize()之前,造成顺序不对。
修改如下:
dataTtransform = transforms.Compose([
transforms.Resize([imageSize, imageSize]),
transforms.ToTensor(),
])