Torchvision cannot save a tensor on integer type

Viewed 113

I try to use Torch to resize some images which I did successfully. The resized images have integer type and when I try to save them I get the error below:

RuntimeError: result type Float can't be cast to the desired output type Byte

I used the code below to resize and save images:

image_temp = torchvision.transforms.Resize([200,200], antialias = True)(image_temp)
torchvision.utils.save_image(image_temp , './test.png')

If I convert the tensor or the image to float type, I can save it without error. Does someone know what the problem with integer data type and saving it is?

0 Answers
Related