Skip to content

Commit a14319c

Browse files
authored
Fix of possible CPU and GPU device error (#2838)
Fixed possible error of two different (CPU and GPU) devices in gaussian function. device and dtype of `mean` are always the same as `sigma`, so it can be reused without any possible errors, but fixing possible error of `sigma` being GPU tensor and `mean` being float value, binding to CPU by default.
1 parent d6e1485 commit a14319c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kornia/filters/kernels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def gaussian(
8989

9090
mean = float(window_size // 2) if mean is None else mean
9191
if isinstance(mean, float):
92-
mean = tensor([[mean]], device=device, dtype=dtype)
92+
mean = tensor([[mean]], device=sigma.device, dtype=sigma.dtype)
9393

9494
KORNIA_CHECK_IS_TENSOR(mean)
9595
KORNIA_CHECK_SHAPE(mean, ["B", "1"])

0 commit comments

Comments
 (0)