I am running code on torch==0.3.1 & torchvision==0.2.1.
(1) I have output of CNN stored in “var_1” having torch.Size([3, 512, 512]) <class ‘torch.cuda.FloatTensor’>. I used “save_image(zz,‘t1.png’)” command to save as image but shows the error “TypeError: tensor or list of tensors expected, got <class ‘torch.autograd.variable.Variable’>”
I try to use “var_1= torch.from_numpy(numpy.array(var_1))” command before save_image but system hang. How can i save it as image?
(2) I found difference between variable and tensor is gradient propagation. But i think that difference is not present in latest version. If it is then after which version the vector and variable are the same?
I’m not sure, what causes this error in these old versions, but you should be able to transform the tensor to a numpy array, permute its dimensions to [height, width, channels] and use matplotlib.pyplot.imshow to visualize the image.