Bug on torchvision.transforms.functional.resize?

Hi,

I encountered a strange problem where my input of a torch.tensor on torchvision.transforms.functional.resize works with visual studio code but when i try to run torchvision.transforms.functional.resize on jupyter notebook with the same input, it gives an error of this

‘’‘TypeError: img should be PIL Image. Got <class ‘torch.Tensor’>’’’

Both notebook running the same version of torchvision 0.7.0.

It’s hard to say without looking at your code, but check the type of whatever is being passed into resize to ensure that it’s a PIL image as expected (you mentioned that you are putting in a tensor and it expects a PIL image). When weird issues come up in a jupyter notebook it might help to refresh the kernel to ensure that you are not using old variables as well.

yea, the resize accepts either a PIL image or a torch.tensor as stated in the documentation, thats why I find it quite weird

Transformations accepting tensors were added in 0.8.0 as stated in the release notes, so I guess your VS environment might use the latest torchvision release, while your Jupyter env might use an older one.

Thanks for this info! I updated it!