Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

skip TestEfficientViT::test_smoke_large for torch lower than 2.0.0 (#2664)

Edgar Riba7fbe5558cdff
diff --git a/test/contrib/models/test_efficient_vit.py b/test/contrib/models/test_efficient_vit.py
index 6ac37428f..6dc8efbdc 100644
--- a/test/contrib/models/test_efficient_vit.py
+++ b/test/contrib/models/test_efficient_vit.py
@@ -5,6 +5,7 @@ import torch
from kornia.contrib.models.efficient_vit import EfficientViT, EfficientViTConfig
from kornia.contrib.models.efficient_vit import backbone as vit
+from kornia.utils._compat import torch_version_lt
class TestEfficientViT:
@@ -28,11 +29,13 @@ class TestEfficientViT:
self._test_smoke(device, dtype, img_size, expected_resolution, model_name)
@pytest.mark.slow
+ @pytest.mark.skipif(torch_version_lt(2, 0, 0), reason="requires torch 2.0.0 or higher")
@pytest.mark.parametrize("model_name", ["l0", "l1", "l2", "l3"])
@pytest.mark.parametrize("img_size,expected_resolution", [(224, 7), (256, 8), (288, 9), (320, 10), (384, 12)])
def test_smoke_large(self, device, dtype, img_size: int, expected_resolution: int, model_name: str):
self._test_smoke(device, dtype, img_size, expected_resolution, model_name)
+ @pytest.mark.skipif(torch_version_lt(2, 0, 0), reason="requires torch 2.0.0 or higher")
def test_onnx(self, device, dtype, tmp_path: Path):
model: vit.EfficientViTBackbone = vit.efficientvit_backbone_b0()
model = model.to(device=device, dtype=dtype)