Unverified Commit 1878e868 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

revert 255 -> max_value fix (#6826)

parent 788ad12e
......@@ -313,7 +313,8 @@ def posterize(inpt: features.InputTypeJIT, bits: int) -> features.InputTypeJIT:
def solarize_image_tensor(image: torch.Tensor, threshold: float) -> torch.Tensor:
if threshold > _FT._max_value(image.dtype):
bound = 1 if image.is_floating_point() else 255
if threshold > bound:
raise TypeError(f"Threshold should be less or equal the maximum value of the dtype, but got {threshold}")
return torch.where(image >= threshold, invert_image_tensor(image), image)
......@@ -466,7 +467,7 @@ def invert_image_tensor(image: torch.Tensor) -> torch.Tensor:
if image.dtype == torch.uint8:
return image.bitwise_not()
else:
return _FT._max_value(image.dtype) - image # type: ignore[no-any-return]
return (1 if image.is_floating_point() else 255) - image # type: ignore[no-any-return]
invert_image_pil = _FP.invert
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment