Pytorch:TypeError: pic should be PIL Image or ndarray. Got <class ‘torch.Tensor‘>
关键代码x=torch.randn(64,3,128,128)transform=transforms.Compose([transforms.Resize(64),transforms.ToTensor(),transforms.Normalize([0.5],[0.5])])transform(x)原因在于x本就是Tensor类型的,有写了一次ToTensor()转换类型,因此会报错。解决办法