From a68fa20ec3819db49e1a0bfadf8faccbce0275f7 Mon Sep 17 00:00:00 2001 From: Francisco Massa Date: Wed, 10 Mar 2021 09:04:20 -0800 Subject: [PATCH] [fbsync] fixed Gamma casting (#3472) Summary: * fixed origin head * fixed inconsistent casting * updated functional_tensor.py Modified the .to() method to convert_image_dtype() method. * Apply suggestions from code review Reviewed By: NicolasHug, cpuhrsch Differential Revision: D26945731 fbshipit-source-id: eab2e30c37bc1d29cae2d0921c869af22b49866a Co-authored-by: Vasilis Vryniotis --- torchvision/transforms/functional_tensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/torchvision/transforms/functional_tensor.py b/torchvision/transforms/functional_tensor.py index 69445e6a231..d20d24a8413 100644 --- a/torchvision/transforms/functional_tensor.py +++ b/torchvision/transforms/functional_tensor.py @@ -227,7 +227,6 @@ def adjust_gamma(img: Tensor, gamma: float, gain: float = 1) -> Tensor: result = (gain * result ** gamma).clamp(0, 1) result = convert_image_dtype(result, dtype) - result = result.to(dtype) return result