π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
fix linter and mypy error for laplacian
edgarribaf08c7e0414b5
diff --git a/mypy_files.txt b/mypy_files.txtindex faa430ee5..37b43dbfa 100644--- a/mypy_files.txt+++ b/mypy_files.txt@@ -3,6 +3,7 @@ torchgeometry/core/depth_warper.pytorchgeometry/core/pinhole.pytorchgeometry/image/gaussian.pytorchgeometry/image/color.py+torchgeometry/image/laplacian.pytorchgeometry/losses/ssim.pytorchgeometry/losses/dice.pytorchgeometry/losses/focal.pydiff --git a/test/test_image.py b/test/test_image.pyindex a664bc28c..04c66910c 100644--- a/test/test_image.py+++ b/test/test_image.py@@ -49,7 +49,7 @@ class TestGaussianBlur:input = utils.tensor_to_gradcheck_var(input) # to varassert gradcheck(image.gaussian_blur, (input, kernel_size, sigma,),raise_exception=True)-+def test_jit(self):batch_size, channels, height, width = 2, 3, 64, 64img = torch.ones(batch_size, channels, height, width)@@ -101,8 +101,8 @@ class TestLaplacian:input = utils.tensor_to_gradcheck_var(input)assert gradcheck(image.laplacian, (input, kernel_size,),raise_exception=True)--++class TestRgbToGrayscale:def test_rgb_to_grayscale(self):channels, height, width = 3, 4, 5@@ -126,4 +126,4 @@ class TestRgbToGrayscale:img = torch.ones(batch_size, channels, height, width)gray = image.RgbToGrayscale()gray_traced = torch.jit.trace(image.RgbToGrayscale(), img)- assert_allclose(gray(img), gray_traced(img))\ No newline at end of file+ assert_allclose(gray(img), gray_traced(img))diff --git a/torchgeometry/image/__init__.py b/torchgeometry/image/__init__.pyindex 622d18e46..9788c1e23 100644--- a/torchgeometry/image/__init__.py+++ b/torchgeometry/image/__init__.py@@ -2,4 +2,4 @@ from .gaussian import get_gaussian_kernel, get_gaussian_kernel2dfrom .gaussian import GaussianBlur, gaussian_blurfrom .laplacian import get_laplacian_kernel, get_laplacian_kernel2dfrom .laplacian import Laplacian, laplacian-from .color import rgb_to_grayscale, RgbToGrayscale\ No newline at end of file+from .color import rgb_to_grayscale, RgbToGrayscalediff --git a/torchgeometry/image/laplacian.py b/torchgeometry/image/laplacian.pyindex 7692ee5f9..4890994c2 100644--- a/torchgeometry/image/laplacian.py+++ b/torchgeometry/image/laplacian.py@@ -124,7 +124,7 @@ class Laplacian(nn.Module):computed = (kernel_size - 1) // 2return computed- def forward(self, x: torch.Tensor):+ def forward(self, x: torch.Tensor): # type: ignoreif not torch.is_tensor(x):raise TypeError("Input x type is not a torch.Tensor. Got {}".format(type(x)))