仅作为记录,大佬请跳过。
import torchvision.transforms as transforms
unloader = transforms.ToPILImage()
def tensor_to_PIL(tensor):
image = tensor.cpu().clone()
image = image.squeeze(0)
image = unloader(image)
return image
img_t_i=tensor_to_PIL(img_t)
感谢大佬博主文章:传送门