PyCharm调试debug时在console中查看PyTorch的tensor图像

停在断点处时,在控制台输入相关指令;

# debug时在console中查看tensor图像
image_tensor = target.cpu()
image_array = image_tensor.numpy()
from PIL import Image
image_PIL = Image.fromarray(image_array.astype('uint8'))
image_PIL.save("/home/wang/home/wang/aa.jpg")

你可能感兴趣的:(调试技巧,学习Python,pytorch,pycharm,python,tensor,debug)