TypeError: img should be PIL Image. Got  even though using latest pytorch version
I had to create a new pytorch environment in Anaconda, I created my code and it worked fine in my old environment. I then created the new environment with the same version of pytorch and cuda 10.1 (but then updated to cuda 11, same as the old one. WHen i try to run the same code i get the error:
TypeError: img should be PIL Image. Got &lt;class 'torch.Tensor'&gt;
When trying to apply any transformation to my tensors, for example the following code gives me an error:
def randRoll(batch, deg):
rotator = torchvision.transforms.RandomRotation(deg)
batch = rotator(batch)
return batch

Nothing has changed and I can't understand why i would get this.
Any suggestions?

Solved
Turns out somehow torchvision 0.2.2 had been installed instead of the latest 0.9.1 (which my other environment used).
This was solved by uninstalling torchvision using
conda remove torchvision

then installing torchvision using pip (using conda install gave me version 0.2.2)
pip install torchvision

I also had to reinstall six using pip.
