diff --git a/torchvision/transforms/_functional_pil.py b/torchvision/transforms/_functional_pil.py index 527879bb6f1..bd943b6ee10 100644 --- a/torchvision/transforms/_functional_pil.py +++ b/torchvision/transforms/_functional_pil.py @@ -110,7 +110,7 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image: np_h = np.array(h, dtype=np.uint8) # This will over/underflow, as desired - np_h += np.array(hue_factor * 255).astype(np.uint8) + np_h += np.int32(hue_factor * 255).astype(np.uint8) h = Image.fromarray(np_h, "L")