Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prototype] Minor change on adjust_saturation_image_tensor uint8 #6940

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion torchvision/prototype/transforms/functional/_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ def adjust_saturation_image_tensor(image: torch.Tensor, saturation_factor: float
if c == 1: # Match PIL behaviour
return image

return _blend(image, _rgb_to_gray(image), saturation_factor)
grayscale_image = _rgb_to_gray(image, cast=False)
if not image.is_floating_point():
grayscale_image = grayscale_image.floor_()

return _blend(image, grayscale_image, saturation_factor)


adjust_saturation_image_pil = _FP.adjust_saturation
Expand Down