Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fixed check for border type (#1377)

Sravan Chittupalli9c44064ac7ad
diff --git a/kornia/filters/filter.py b/kornia/filters/filter.py
index 051469630..adeef2698 100644
--- a/kornia/filters/filter.py
+++ b/kornia/filters/filter.py
@@ -79,7 +79,11 @@ def filter2d(
raise TypeError(f"Input border_type is not torch.Tensor. Got {type(kernel)}")
if not isinstance(border_type, str):
- raise TypeError(f"Input border_type is not string. Got {type(kernel)}")
+ raise TypeError(f"Input border_type is not string. Got {type(border_type)}")
+
+ if border_type not in ['constant', 'reflect', 'replicate', 'circular']:
+ raise ValueError(f"Invalid border type, we expect 'constant', \
+ 'reflect', 'replicate', 'circular'. Got:{border_type}")
if not isinstance(padding, str):
raise TypeError(f"Input padding is not string. Got {type(padding)}")