Pytorch把Tensor转化成图像可视化 在调试程序的时候经常想把tensor可视化成来看看,可以这样操作: from torchvision import transforms unloader = transforms.ToPILImage() image = original_tensor.cpu().clone() # clone the tensor image = image.squeeze(0) # remove the fake batch dimension image = unloader(image) image.save('example.jpg')