🐛 Describe the bug
Setting 5.3 and 9 to bits argument of RandomPosterize() gets the indirect error message as shown below:
from torchvision.datasets import OxfordIIITPet
from torchvision.transforms.v2 import RandomPosterize
my_data1 = OxfordIIITPet(
root="data", # ↓↓↓
transform=RandomPosterize(bits=5.3)
)
my_data2 = OxfordIIITPet(
root="data", # ↓
transform=RandomPosterize(bits=9)
)
my_data1[0] # Error
my_data2[0] # Error
TypeError: bad operand type for unary ~: 'float'
TypeError: bad operand type for unary ~: 'float'
So, they should be something direct like below respectively:
TypeError: bits must be int
ValueError: bits must be [0, 8]
Versions
import torchvision
torchvision.__version__ # '0.20.1'