Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fixes

Dmytro Mishkin8a7e2ce55cbb
diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644
index e8c71a9d5..000000000
--- a/.coveragerc
+++ /dev/null
@@ -1,4 +0,0 @@
-[report]
-exclude_lines =
- pragma: no cover
- raise
diff --git a/kornia/filters/blur.py b/kornia/filters/blur.py
index 000f7361c..fef0c2081 100644
--- a/kornia/filters/blur.py
+++ b/kornia/filters/blur.py
@@ -24,9 +24,10 @@ class BoxBlur(nn.Module):
Args:
kernel_size (Tuple[int, int]): the blurring kernel size.
- borde_type (str): the padding mode to be applied before convolving.
+ border_type (str): the padding mode to be applied before convolving.
The expected modes are: ``'constant'``, ``'reflect'``,
``'replicate'`` or ``'circular'``. Default: ``'reflect'``.
+ normalized (bool): if True, L1 norm of the kernel is set to 1.
Returns:
torch.Tensor: the blurred input tensor.
diff --git a/kornia/filters/filter.py b/kornia/filters/filter.py
index a835feb2b..c1392bb4e 100644
--- a/kornia/filters/filter.py
+++ b/kornia/filters/filter.py
@@ -33,7 +33,7 @@ def filter2D(input: torch.Tensor, kernel: torch.Tensor,
border_type (str): the padding mode to be applied before convolving.
The expected modes are: ``'constant'``, ``'reflect'``,
``'replicate'`` or ``'circular'``. Default: ``'reflect'``.
- normalized (bool): If True, kernel will be L1 normalized
+ normalized (bool): If True, kernel will be L1 normalized.
Return:
torch.Tensor: the convolved tensor of same size and numbers of channels
diff --git a/kornia/filters/kernels.py b/kornia/filters/kernels.py
index 535f520d9..ee6fa0e2b 100644
--- a/kornia/filters/kernels.py
+++ b/kornia/filters/kernels.py
@@ -7,6 +7,9 @@ import torch.nn as nn
def normalize_kernel2d(input: torch.Tensor) -> torch.Tensor:
r"""Normalizes both derivative and smoothing kernel.
"""
+ if len(input.size()) < 2:
+ raise TypeError("input should be at least 2D tensor. Got {}"
+ .format(input.size()))
norm: torch.Tensor = input.abs().sum(dim=-1).sum(dim=-1)
return input / (norm.unsqueeze(-1).unsqueeze(-1))
diff --git a/kornia/filters/laplacian.py b/kornia/filters/laplacian.py
index a53bdb6d1..f395e42de 100644
--- a/kornia/filters/laplacian.py
+++ b/kornia/filters/laplacian.py
@@ -16,9 +16,10 @@ class Laplacian(nn.Module):
Arguments:
kernel_size (int): the size of the kernel.
- borde_type (str): the padding mode to be applied before convolving.
+ border_type (str): the padding mode to be applied before convolving.
The expected modes are: ``'constant'``, ``'reflect'``,
``'replicate'`` or ``'circular'``. Default: ``'reflect'``.
+ normalized (bool): if True, L1 norm of the kernel is set to 1.
Returns:
Tensor: the tensor.
diff --git a/kornia/filters/sobel.py b/kornia/filters/sobel.py
index b385623bb..cf61fe563 100644
--- a/kornia/filters/sobel.py
+++ b/kornia/filters/sobel.py
@@ -67,6 +67,9 @@ class Sobel(nn.Module):
Return:
torch.Tensor: the sobel edge gradient maginitudes map.
+ Args:
+ normalized (bool): if True, L1 norm of the kernel is set to 1.
+
Shape:
- Input: :math:`(B, C, H, W)`
- Output: :math:`(B, C, H, W)`
@@ -125,4 +128,4 @@ def sobel(input: torch.Tensor, normalized: bool = True) -> torch.Tensor:
See :class:`~kornia.filters.Sobel` for details.
"""
- return Sobel(normalized=normalized)(input)
+ return Sobel(normalized)(input)
diff --git a/setup.cfg b/setup.cfg
index e209e3310..e0d26149e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,12 +15,11 @@ max-line-length = 80
ignore = F401,E402,F403,F811
exclude = venv
-[report]
+[coverage:report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
- raise AssertionError
- raise NotImplementedError
+ raise
if 0:
if __name__ == .__main__.: