Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

back to groupconv backend for filter2d (#600)

Dmytro Mishkin215af7b396bc
diff --git a/kornia/filters/filter.py b/kornia/filters/filter.py
index 3dde7ff3a..dc256fb49 100644
--- a/kornia/filters/filter.py
+++ b/kornia/filters/filter.py
@@ -96,12 +96,6 @@ def filter2D(input: torch.Tensor, kernel: torch.Tensor,
padding_shape: List[int] = compute_padding([height, width])
input_pad: torch.Tensor = F.pad(input, padding_shape, mode=border_type)
- # convolve the tensor with the kernel. Pick the fastest alg
- kernel_numel: int = height * width
- if kernel_numel > 81:
- b, c, hp, wp = input_pad.shape
- return F.conv2d(input_pad.reshape(b * c, 1, hp, wp), tmp_kernel, padding=0, stride=1).view(b, c, h, w)
-
return F.conv2d(input_pad, tmp_kernel.expand(c, -1, -1, -1), groups=c, padding=0, stride=1)