π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
test(filters): skip the #5379 and #5387 pins where the pad kernel is missing (#5428)
εΊζ’η8be1eda51724
diff --git a/tests/filters/test_blur_pool.py b/tests/filters/test_blur_pool.pyindex dd747ea73..029c70ae9 100644--- a/tests/filters/test_blur_pool.py+++ b/tests/filters/test_blur_pool.py@@ -32,7 +32,7 @@ from kornia.filters import (max_blur_pool2d,)-from testing.base import BaseTester+from testing.base import BaseTester, supports_reflect_paddingdef _zero_padded_reference(x: torch.Tensor, k: int, s: int) -> torch.Tensor:@@ -310,6 +310,9 @@ class TestEdgeAwareBlurPool(BaseTester):edge_aware_blur_pool2d(data, 3, edge_threshold=edge_threshold)with pytest.raises(BaseError, match=f"edge_threshold must be greater than 1. Got {edge_threshold}"):EdgeAwareBlurPool2D(3, edge_threshold=edge_threshold)(data)+ # Only the accepted threshold reaches the reflect padding; the rejections above run everywhere.+ if not supports_reflect_padding(device, dtype):+ pytest.skip("reflection_pad2d is unavailable for this device/dtype")assert edge_aware_blur_pool2d(data, 3, edge_threshold=1.0001).shape == data.shape@pytest.mark.parametrize("batch_size", [1, 2])diff --git a/tests/filters/test_sobel.py b/tests/filters/test_sobel.pyindex a37653437..4b89f6fcb 100644--- a/tests/filters/test_sobel.py+++ b/tests/filters/test_sobel.py@@ -25,7 +25,7 @@ from kornia.core._compat import torch_versionfrom kornia.filters import Sobel, SpatialGradient, SpatialGradient3d, sobel, spatial_gradient, spatial_gradient3dfrom kornia.filters.kernels import get_spatial_gradient_kernel2d, normalize_kernel2d-from testing.base import BaseTester+from testing.base import BaseTester, supports_replicate_padding, supports_replicate_padding_3dsobel_module = importlib.import_module("kornia.filters.sobel")@@ -168,6 +168,8 @@ class TestSpatialGradient(BaseTester):@pytest.mark.parametrize("normalized", [True, False])def test_convention_upper_case_sobel_takes_the_fixed_kernel_path_5156(self, normalized, monkeypatch, device, dtype):"""mode='Sobel' at order=1 uses the fixed kernel of 'sobel' and does not call the kernel builder (#5156)."""+ if not supports_replicate_padding(device, dtype):+ pytest.skip("spatial_gradient pads with mode='replicate', which this device lacks for this dtype")def should_not_run(*args, **kwargs):raise AssertionError("order=1 Sobel on a floating input must use the fixed kernel")@@ -500,6 +502,8 @@ class TestSpatialGradient3d(BaseTester):def test_convention_upper_case_diff_takes_the_slicing_path_5156(self, monkeypatch, device, dtype):"""mode='Diff' at order=1 takes the slicing path of 'diff' and does not call the kernel builder (#5156)."""+ if not supports_replicate_padding_3d(device, dtype):+ pytest.skip("spatial_gradient3d pads with mode='replicate', which this device lacks for this dtype")def should_not_run(*args, **kwargs):raise AssertionError("order=1 diff must use the slicing path")