π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
fix(enhance): move sharpness factor onto the input device/dtype (#3830)
Edgar Ribad6559feebd8a
diff --git a/kornia/enhance/adjust.py b/kornia/enhance/adjust.pyindex 36e8e0941..505e6017b 100644--- a/kornia/enhance/adjust.py+++ b/kornia/enhance/adjust.py@@ -855,6 +855,10 @@ def sharpness(input: torch.Tensor, factor: Union[float, torch.Tensor]) -> torch."""if not isinstance(factor, torch.Tensor):factor = torch.as_tensor(factor, device=input.device, dtype=input.dtype)+ else:+ # Match the input's device/dtype (as adjust_brightness/contrast do). Augmentation+ # generators may sample the factor on a different device (e.g. CPU) than the image.+ factor = factor.to(device=input.device, dtype=input.dtype)if len(factor.size()) != 0 and factor.shape != torch.Size([input.size(0)]):raise AssertionError(