[pytorch报错]TypeError: tensor is not a torch image.
原因是使用torchvision.transforms.Compose传入的参数中Normalize一定要在ToTensor后面
要这么写:
transform=transforms.Compose([
transforms.Resize((28, 28)),
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))]))
而不能:
transform=transforms.Compose([
transforms.Resize((28, 28)),
transforms.Normalize((0.1307,), (0.3081,)),
transforms.ToTensor()]))