Description
Across our transformations we sometimes hardcode the value 255
. This is justified if we make sure that point only torch.uint8
images are allowed, like
vision/torchvision/transforms/functional_tensor.py
Lines 471 to 472 in 788ad12
However, there are a few instances where uint8 is implied but never enforced:
vision/torchvision/transforms/functional_tensor.py
Lines 266 to 267 in 788ad12
vision/torchvision/transforms/functional_tensor.py
Lines 778 to 779 in 788ad12
Instead of hardcoding 255
here, we should either use _max_value(dtype)
instead or if uint8 is actually required, enforce it.