-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
The parameters passed to ColorJitter can be passed either as single number or as a two-tuple. Doing the former internally creates a two tuple as well using the passed value as offset from a hardcoded center. For example, the center for hue is 0 and so we have
from torchvision.prototype import transforms
transform1 = transforms.ColorJitter(hue=0.3)
transform2 = transforms.ColorJitter(hue=(-0.3, 0.3))
assert transform1.hue == transform2.hueHowever, when it comes to check for out of bounds values, passing a single value goes unchecked, while passing the corresponding two-tuple fails
transform1 = transforms.ColorJitter(hue=1.0)
assert transform1.hue == (-1.0, 1.0)
transforms.ColorJitter(hue=(-1.0, 1.0))ValueError: hue values should be between (-0.5, 0.5)
We should apply the same check to the single value as well.
cc @vfdev-5