torchvision.transforms.ColorJitter: hue != 0 produces error when used on tensor

I want to make some transformations outside the Dataloader with torchvision.transforms. ColorJitter. However, when I use hue!= 0, I receive:

a = torch.randn(3, 128, 128)
a_T = torchvision.transforms.ColorJitter(brightness=0.5, contrast=0.5, saturation=0.5, hue=0)(a)    # works
a_t = torchvision.transforms.ColorJitter(brightness=0.5, contrast=0.5, saturation=0.5, hue=0.5)(a)  # error

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

With hue=0 it works, so apparently there seems to be a bug. Can someone confirm this or explain how to work around that issue?

The code works using torchvision==0.8.0.dev20201006 and it seems the functionality was added in this PR.
You could update to the latest nightly binary, build from source, or wait for the next stable release. :wink: