Skip to content

Commit

Permalink
Use two step conversion from float to uint8 to reduce platform depend…
Browse files Browse the repository at this point in the history
…ence
  • Loading branch information
sclarkson committed Aug 30, 2024
1 parent db60022 commit b6d16e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchvision/transforms/_functional_pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit b6d16e6

Please sign in to comment.