π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
increase test tolerance, so cuda-float16 not failing
Dmytro Mishkin8baf63cd42cb
diff --git a/test/morphology/test_bottom_hat.py b/test/morphology/test_bottom_hat.pyindex b5dce0821..03dedd3e7 100644--- a/test/morphology/test_bottom_hat.py+++ b/test/morphology/test_bottom_hat.py@@ -26,7 +26,7 @@ class TestBottomHat:expected = torch.tensor([[0.2, 0.0, 0.5], [0.0, 0.4, 0.0], [0.3, 0.0, 0.6]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(bottom_hat(tensor, kernel), expected)+ assert_allclose(bottom_hat(tensor, kernel), expected, atol=1e-3, rtol=1e-3)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestBottomHat:None, None, :, :]assert_allclose(- bottom_hat(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ bottom_hat(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-3, rtol=1e-3)def test_exception(self, device, dtype):diff --git a/test/morphology/test_closing.py b/test/morphology/test_closing.pyindex c77c4fe07..d739d8f9e 100644--- a/test/morphology/test_closing.py+++ b/test/morphology/test_closing.py@@ -26,7 +26,7 @@ class TestClosing:expected = torch.tensor([[0.7, 1.0, 0.8], [0.7, 0.7, 0.8], [0.7, 0.9, 0.8]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(closing(tensor, kernel), expected)+ assert_allclose(closing(tensor, kernel), expected, atol=1e-4, rtol=1e-4)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestClosing:None, None, :, :]assert_allclose(- closing(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ closing(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-4, rtol=1e-4)def test_exception(self, device, dtype):diff --git a/test/morphology/test_dilation.py b/test/morphology/test_dilation.pyindex 3709032d6..6d57fffb9 100644--- a/test/morphology/test_dilation.py+++ b/test/morphology/test_dilation.py@@ -26,7 +26,7 @@ class TestDilate:expected = torch.tensor([[1.0, 1.0, 1.0], [0.7, 1.0, 0.8], [0.9, 0.9, 0.9]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(dilation(tensor, kernel), expected)+ assert_allclose(dilation(tensor, kernel), expected, atol=1e-4, rtol=1e-4)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestDilate:None, None, :, :]assert_allclose(- dilation(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ dilation(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-4, rtol=1e-4)def test_exception(self, device, dtype):diff --git a/test/morphology/test_erosion.py b/test/morphology/test_erosion.pyindex a96a04f85..0f50fc973 100644--- a/test/morphology/test_erosion.py+++ b/test/morphology/test_erosion.py@@ -26,7 +26,7 @@ class TestErode:expected = torch.tensor([[0.5, 0.3, 0.3], [0.3, 0.3, 0.2], [0.4, 0.2, 0.2]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(erosion(tensor, kernel), expected)+ assert_allclose(erosion(tensor, kernel), expected, atol=1e-4, rtol=1e-4)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestErode:None, None, :, :]assert_allclose(- erosion(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ erosion(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-4, rtol=1e-4)def test_exception(self, device, dtype):diff --git a/test/morphology/test_gradient.py b/test/morphology/test_gradient.pyindex f12c0bf72..6830e54af 100644--- a/test/morphology/test_gradient.py+++ b/test/morphology/test_gradient.py@@ -26,7 +26,7 @@ class TestGradient:expected = torch.tensor([[0.5, 0.7, 0.7], [0.4, 0.7, 0.6], [0.5, 0.7, 0.7]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(gradient(tensor, kernel), expected)+ assert_allclose(gradient(tensor, kernel), expected, atol=1e-3, rtol=1e-3)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestGradient:None, None, :, :]assert_allclose(- gradient(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ gradient(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-3, rtol=1e-3)def test_exception(self, device, dtype):diff --git a/test/morphology/test_opening.py b/test/morphology/test_opening.pyindex 0940de775..75969ad9c 100644--- a/test/morphology/test_opening.py+++ b/test/morphology/test_opening.py@@ -26,7 +26,7 @@ class TestOpening:expected = torch.tensor([[0.5, 0.5, 0.3], [0.5, 0.3, 0.3], [0.4, 0.4, 0.2]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(opening(tensor, kernel), expected)+ assert_allclose(opening(tensor, kernel), expected, atol=1e-4, rtol=1e-4)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestOpening:None, None, :, :]assert_allclose(- opening(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ opening(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-4, rtol=1e-4)def test_exception(self, device, dtype):diff --git a/test/morphology/test_top_hat.py b/test/morphology/test_top_hat.pyindex a275bb841..575d2be5b 100644--- a/test/morphology/test_top_hat.py+++ b/test/morphology/test_top_hat.py@@ -26,7 +26,7 @@ class TestTopHat:expected = torch.tensor([[0.0, 0.5, 0.0], [0.2, 0.0, 0.5], [0.0, 0.5, 0.0]], device=device, dtype=dtype)[None, None, :, :]- assert_allclose(top_hat(tensor, kernel), expected)+ assert_allclose(top_hat(tensor, kernel), expected, atol=1e-3, rtol=1e-3)def test_structural_element(self, device, dtype):tensor = torch.tensor([[0.5, 1.0, 0.3], [0.7, 0.3, 0.8], [0.4, 0.9, 0.2]], device=device, dtype=dtype)[@@ -39,7 +39,8 @@ class TestTopHat:None, None, :, :]assert_allclose(- top_hat(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected+ top_hat(tensor, torch.ones_like(structural_element), structuring_element=structural_element), expected,+ atol=1e-3, rtol=1e-3)def test_exception(self, device, dtype):