Skip to content

Commit

Permalink
Use better way from warning
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Jun 3, 2024
1 parent 0670bc1 commit fb4fb59
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions torchvision/transforms/_functional_pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,8 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image:
h, s, v = img.convert("HSV").split()

np_h = np.array(h, dtype=np.uint8)
with np.errstate(over="ignore"):
shift = int(hue_factor * 255)
if shift > 0:
np_h += shift
else:
np_h -= abs(shift)
# This will over/underflow, as desired
np_h += np.array(hue_factor * 255).astype(np.uint8)

h = Image.fromarray(np_h, "L")

Expand Down

0 comments on commit fb4fb59

Please sign in to comment.