π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
ci: install the selected PyTorch matrix version (#3995)
Parshav Singla35555b55dd3b
diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.ymlindex 3b87b9a07..7173a823d 100644--- a/.github/workflows/scheduled_test_cpu.yml+++ b/.github/workflows/scheduled_test_cpu.yml@@ -10,6 +10,7 @@ on:- 'COPYRIGHT'schedule:- cron: '0 4 * * *'+ workflow_dispatch:workflow_call:permissions:@@ -104,12 +105,25 @@ jobs:fail-fast: falsematrix:pytorch-dtype: ["float32", "float64"]+ python-version: ["3.11", "3.12", "3.13"]+ pytorch-version: ["2.1.2", "2.2.2", "2.3.1", "2.4.0", "2.5.1", "2.9.1"]+ exclude:+ - python-version: "3.12"+ pytorch-version: "2.1.2"+ - python-version: "3.13"+ pytorch-version: "2.1.2"+ - python-version: "3.13"+ pytorch-version: "2.2.2"+ - python-version: "3.13"+ pytorch-version: "2.3.1"+ - python-version: "3.13"+ pytorch-version: "2.4.0"uses: ./.github/workflows/tests.ymlwith:os: "ubuntu-latest"- python-version: '["3.11", "3.12", "3.13"]'- pytorch-version: '["2.1.2", "2.2.2", "2.3.1", "2.4.0", "2.5.1", "2.9.1"]'+ python-version: '["${{ matrix.python-version }}"]'+ pytorch-version: '["${{ matrix.pytorch-version }}"]'pytorch-dtype: ${{ matrix.pytorch-dtype }}cache-path: weights/cache-key: model-weights-${{ needs.pre-tests.outputs.hash }}diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 3d023a88e..9ef991fa9 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -88,6 +88,23 @@ jobs:- name: Install dependenciesrun: pixi run -e ${{ steps.pixi-env.outputs.name }} install+ - name: Install PyTorch matrix version+ shell: bash+ env:+ PYTORCH_VERSION: ${{ matrix.pytorch-version }}+ run: |+ if [[ "$PYTORCH_VERSION" =~ ^2\.[1-4]\. ]]; then+ pixi run -e ${{ steps.pixi-env.outputs.name }} uv run --no-sync uv pip install "numpy<2"+ fi+ pixi run -e ${{ steps.pixi-env.outputs.name }} uv run --no-sync uv pip install \+ --reinstall-package torch --index-url https://download.pytorch.org/whl/cpu "torch==$PYTORCH_VERSION"++ - name: Verify PyTorch version+ env:+ EXPECTED_PYTORCH_VERSION: ${{ matrix.pytorch-version }}+ run: |+ pixi run -e ${{ steps.pixi-env.outputs.name }} uv run --no-sync python -c 'import os, torch; expected = os.environ["EXPECTED_PYTORCH_VERSION"]; version = torch.__version__; print(f"expected {expected}, got {version}"); assert version.startswith(expected)'+# torch Windows wheels crash with STATUS_ILLEGAL_INSTRUCTION (0xc000001d) inside# affine_grid on part of the runner fleet β observed on torch 2.5.1 AND 2.9.1, on both# windows-2022 and windows-2025 (host-CPU-dependent: the CPU-autocast bf16 path@@ -106,4 +123,5 @@ jobs:KORNIA_TEST_DTYPE: ${{ inputs.pytorch-dtype }}KORNIA_TEST_RUNSLOW: ${{ inputs.runslow }}KORNIA_TEST_OPTIMIZER: ${{ inputs.optimizer }}+ UV_NO_SYNC: "1"run: pixi run -e ${{ steps.pixi-env.outputs.name }} test ${{ inputs.pytest-extra }}diff --git a/conftest.py b/conftest.pyindex b6ab89af0..91cf8b1b9 100644--- a/conftest.py+++ b/conftest.py@@ -316,15 +316,18 @@ def pytest_sessionstart(session):if session.config.getoption("--tf32"):torch.set_float32_matmul_precision("high")- # Skip torch.compile warmup in subprocess mode β it adds startup overhead and- # pollutes the captured output used for failure reporting in pytest_runtest_protocol.- if not os.environ.get("KORNIA_TEST_IN_SUBPROCESS"):+ # Warm torch.compile only for explicit optimizer jobs. Ordinary jobs deselect compile tests,+ # while subprocess mode also avoids startup overhead and captured-output pollution.+ should_warm_compile = bool(os.environ.get("KORNIA_TEST_OPTIMIZER", "").strip()) and not os.environ.get(+ "KORNIA_TEST_IN_SUBPROCESS"+ )+ if should_warm_compile:try:_setup_torch_compile()except RuntimeError as ex:- if "not yet supported for torch.compile" not in str(+ if "not yet supported for torch.compile" not in str(ex) and "Dynamo is not supported on Python" not in str(ex- ) and "Dynamo is not supported on Python 3.12+" not in str(ex):+ ):raise exos.makedirs(WEIGHTS_CACHE_DIR, exist_ok=True)diff --git a/kornia/augmentation/container/augment.py b/kornia/augmentation/container/augment.pyindex 216b23e4e..3174b6d8e 100644--- a/kornia/augmentation/container/augment.py+++ b/kornia/augmentation/container/augment.py@@ -39,11 +39,13 @@ from .video import VideoSequential__all__ = ["AugmentationSequential"]-_BOXES_OPTIONS = {DataKey.BBOX, DataKey.BBOX_XYXY, DataKey.BBOX_XYWH}-_KEYPOINTS_OPTIONS = {DataKey.KEYPOINTS}-_IMG_OPTIONS = {DataKey.INPUT, DataKey.IMAGE}-_MSK_OPTIONS = {DataKey.MASK}-_CLS_OPTIONS = {DataKey.CLASS, DataKey.LABEL}+# Dynamo cannot trace membership checks against a Python set; tuples keep these constants+# capture-friendly while preserving the membership-only behavior used below.+_BOXES_OPTIONS = (DataKey.BBOX, DataKey.BBOX_XYXY, DataKey.BBOX_XYWH)+_KEYPOINTS_OPTIONS = (DataKey.KEYPOINTS,)+_IMG_OPTIONS = (DataKey.INPUT, DataKey.IMAGE)+_MSK_OPTIONS = (DataKey.MASK,)+_CLS_OPTIONS = (DataKey.CLASS, DataKey.LABEL)MaskDataType = Union[torch.Tensor, List[torch.Tensor]]diff --git a/kornia/core/utils.py b/kornia/core/utils.pyindex bdf0d7242..48ae151b5 100644--- a/kornia/core/utils.py+++ b/kornia/core/utils.py@@ -355,10 +355,20 @@ def is_autocast_enabled(both: bool = True) -> bool:return torch.is_autocast_enabled()-# ``torch.compiler.is_exporting`` is absent on very old torch; resolve it once at import.+# These helpers moved into ``torch.compiler`` over time; resolve them once at import.+_torch_is_compiling = getattr(torch.compiler, "is_compiling", None) or getattr(torch._dynamo, "is_compiling", None)_torch_is_exporting = getattr(torch.compiler, "is_exporting", None)+def is_compiling() -> bool:+ """Whether execution is inside ``torch.compile`` or ``torch.export`` capture.++ Falls back to Torch's older private Dynamo spelling when the public compiler helper is absent.+ """+ return bool(_torch_is_compiling()) if _torch_is_compiling is not None else False++def is_exporting() -> bool:"""Whether execution is inside a ``torch.export`` capture.diff --git a/kornia/feature/lightglue.py b/kornia/feature/lightglue.pyindex 35f941076..cf5aed76b 100644--- a/kornia/feature/lightglue.py+++ b/kornia/feature/lightglue.py@@ -45,7 +45,12 @@ def math_clamp(x, min_, max_): # type: ignorereturn min(max(x, min_), max_)-AMP_CUSTOM_FWD_F32 = torch.amp.custom_fwd(cast_inputs=torch.float32, device_type="cuda")+if hasattr(torch.amp, "custom_fwd"):+ AMP_CUSTOM_FWD_F32 = torch.amp.custom_fwd(cast_inputs=torch.float32, device_type="cuda")+else:+ # ``torch.amp.custom_fwd`` was introduced after Kornia's minimum supported Torch;+ # the CUDA-specific spelling provides the same behavior on older releases.+ AMP_CUSTOM_FWD_F32 = torch.cuda.amp.custom_fwd(cast_inputs=torch.float32)@AMP_CUSTOM_FWD_F32diff --git a/kornia/filters/gaussian.py b/kornia/filters/gaussian.pyindex e6cfcec14..f408d3a23 100644--- a/kornia/filters/gaussian.py+++ b/kornia/filters/gaussian.py@@ -24,6 +24,7 @@ from torch import nnfrom kornia.core._compat import deprecatedfrom kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE+from kornia.core.utils import is_compilingfrom .filter import filter2d, filter2d_separablefrom .kernels import _check_kernel_size, _unpack_2d_ks, get_gaussian_kernel1d, get_gaussian_kernel2d@@ -100,7 +101,7 @@ def gaussian_blur2d(KORNIA_CHECK_SHAPE(sigma, ["B", "2"])# `bool()` on a tensor is untraceable by dynamo; skip the data-dependent check under compile.- if not torch.compiler.is_compiling():+ if not is_compiling():# Only interpolate `sigma` into the message when the check actually fails: a plain# f-string here would format the whole `sigma` tensor (a costly tensor->str) on every# eager call even when it passes β which dominated the eager Gaussian-blur runtime.diff --git a/kornia/geometry/conversions.py b/kornia/geometry/conversions.pyindex 0974b98a2..7b3e92110 100644--- a/kornia/geometry/conversions.py+++ b/kornia/geometry/conversions.py@@ -26,7 +26,7 @@ import torch.nn.functional as Ffrom kornia.constants import pifrom kornia.core._compat import deprecatedfrom kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SHAPE-from kornia.core.utils import _inverse_3x3_closed_form, _torch_inverse_cast+from kornia.core.utils import _inverse_3x3_closed_form, _torch_inverse_cast, is_compiling__all__ = ["ARKitQTVecs_to_ColmapQTVecs",@@ -1493,15 +1493,10 @@ def normalize_pixel_coordinates(raise ValueError(f"Input pixel_coordinates must be of shape (*, 2). Got {pixel_coordinates.shape}")if not torch.jit.is_tracing() and (height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-8- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-8:warnings.warn("`eps` is deprecated and ignored by `normalize_pixel_coordinates`.", FutureWarning, stacklevel=2)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):sx = 1.0 if width == 1 else 2.0 / (width - 1.0)sy = 1.0 if height == 1 else 2.0 / (height - 1.0)tx = 0.0 if width == 1 else -1.0@@ -1573,19 +1568,14 @@ def denormalize_pixel_coordinates(raise ValueError(f"Input pixel_coordinates must be of shape (*, 2). Got {pixel_coordinates.shape}")if not torch.jit.is_tracing() and (height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-8- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-8:warnings.warn("`eps` is deprecated and ignored by `denormalize_pixel_coordinates`.",FutureWarning,stacklevel=2,)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):sx = 1.0 if width == 1 else (width - 1.0) / 2.0sy = 1.0 if height == 1 else (height - 1.0) / 2.0tx = 0.0 if width == 1 else sx@@ -1652,19 +1642,14 @@ def normalize_pixel_coordinates3d(raise ValueError(f"Input pixel_coordinates must be of shape (*, 3). Got {pixel_coordinates.shape}")if not torch.jit.is_tracing() and (depth <= 0 or height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got depth={depth}, height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-8- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-8:warnings.warn("`eps` is deprecated and ignored by `normalize_pixel_coordinates3d`.",FutureWarning,stacklevel=2,)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):sd = 1.0 if depth == 1 else 2.0 / (depth - 1.0)sx = 1.0 if width == 1 else 2.0 / (width - 1.0)sy = 1.0 if height == 1 else 2.0 / (height - 1.0)@@ -1741,19 +1726,14 @@ def denormalize_pixel_coordinates3d(raise ValueError(f"Input pixel_coordinates must be of shape (*, 3). Got {pixel_coordinates.shape}")if not torch.jit.is_tracing() and (depth <= 0 or height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got depth={depth}, height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-8- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-8:warnings.warn("`eps` is deprecated and ignored by `denormalize_pixel_coordinates3d`.",FutureWarning,stacklevel=2,)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):sd = 1.0 if depth == 1 else (depth - 1.0) / 2.0sx = 1.0 if width == 1 else (width - 1.0) / 2.0sy = 1.0 if height == 1 else (height - 1.0) / 2.0@@ -2120,15 +2100,10 @@ def normal_transform_pixel("""if not torch.jit.is_tracing() and (height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-14- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-14:warnings.warn("`eps` is deprecated and ignored by `normal_transform_pixel`.", FutureWarning, stacklevel=2)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):# Eager and TorchScript take the scalar branch, which is an order of magnitude# cheaper on this hot path. Graph capture takes the tensor form below so symbolic# sizes retain the singleton decision.@@ -2234,15 +2209,10 @@ def normal_transform_pixel3d("""if not torch.jit.is_tracing() and (depth <= 0 or height <= 0 or width <= 0):raise ValueError(f"Input image size must be positive. Got depth={depth}, height={height}, width={width}.")- if (- not torch.jit.is_scripting()- and not torch.jit.is_tracing()- and not torch.compiler.is_compiling()- and eps != 1e-14- ):+ if not torch.jit.is_scripting() and not torch.jit.is_tracing() and not is_compiling() and eps != 1e-14:warnings.warn("`eps` is deprecated and ignored by `normal_transform_pixel3d`.", FutureWarning, stacklevel=2)- if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not torch.compiler.is_compiling()):+ if torch.jit.is_scripting() or (not torch.jit.is_tracing() and not is_compiling()):# As in 2-D, graph capture uses the tensor form below for symbolic sizes.sx = 1.0 if width == 1 else 2.0 / (width - 1.0)sy = 1.0 if height == 1 else 2.0 / (height - 1.0)diff --git a/kornia/geometry/grid.py b/kornia/geometry/grid.pyindex 8b38cc5a8..d64fed5d2 100644--- a/kornia/geometry/grid.py+++ b/kornia/geometry/grid.py@@ -20,6 +20,8 @@ from typing import Optionalimport torch+from kornia.core.utils import is_compiling+def create_meshgrid(height: int,@@ -65,7 +67,7 @@ def create_meshgrid([1., 1.]]]])"""- if not torch.jit.is_scripting() and torch.compiler.is_compiling():+ if not torch.jit.is_scripting() and is_compiling():# ``linspace`` specializes symbolic ``steps`` under export; ``arange`` retains the# dynamic output length. Match ``linspace``'s default floating dtype when none is given.arange_dtype = dtype if dtype is not None else torch.get_default_dtype()@@ -83,7 +85,7 @@ def create_meshgrid(# base_grid = K.geometry.normalize_pixel_coordinates(base_grid, height, width)# return torch.unsqueeze(base_grid.transpose(0, 1), dim=0)if normalized_coordinates:- if torch.jit.is_tracing() or torch.compiler.is_compiling():+ if not torch.jit.is_scripting() and (torch.jit.is_tracing() or is_compiling()):# Graph capture needs the tensor form to keep a symbolic size dynamic. Low-precision# floating types cannot represent every practical image size exactly (e.g. bfloat16# rounds 257 to 256 and 299 to 300), so the size arithmetic runs in float32. Divide@@ -144,7 +146,7 @@ def create_meshgrid3d(grid tensor with shape :math:`(1, D, H, W, 3)`."""- if not torch.jit.is_scripting() and torch.compiler.is_compiling():+ if not torch.jit.is_scripting() and is_compiling():arange_dtype = dtype if dtype is not None else torch.get_default_dtype()xs = torch.arange(width, device=device, dtype=arange_dtype)ys = torch.arange(height, device=device, dtype=arange_dtype)@@ -155,7 +157,7 @@ def create_meshgrid3d(zs = torch.linspace(0, depth - 1, depth, device=device, dtype=dtype)# Fix TracerWarningif normalized_coordinates:- if torch.jit.is_tracing() or torch.compiler.is_compiling():+ if not torch.jit.is_scripting() and (torch.jit.is_tracing() or is_compiling()):# See ``create_meshgrid``: low-precision dtypes round large sizes, so the size# arithmetic runs in float32 and the quotient, not the divisor, is what gets cast down.work_dtype = torch.float32 if xs.dtype in (torch.float16, torch.bfloat16) else xs.dtypediff --git a/testing/base.py b/testing/base.pyindex 29d6ad413..66d99e215 100644--- a/testing/base.py+++ b/testing/base.py@@ -18,6 +18,7 @@from __future__ import annotationsimport math+import sysfrom functools import cachefrom typing import Any, Callable, Optional, Sequence, Union@@ -27,9 +28,19 @@ import torch.nn.functional as Ffrom torch.autograd import gradcheckfrom torch.testing import assert_close as _assert_close+from kornia.core._compat import torch_version_lt+Dtype = Union[torch.dtype, None]Tensor = torch.Tensor+DYNAMO_UNAVAILABLE_REASON = "torch.compile requires torch>=2.6 on Python>=3.13"+++def dynamo_is_available() -> bool:+ """Return whether this Torch/Python pair can run Dynamo-backed capture."""+ return not (torch_version_lt(2, 6, 0) and sys.version_info >= (3, 13))++# {dtype: (rtol, atol)}_DTYPE_PRECISIONS = {torch.bfloat16: (7.8e-3, 7.8e-3),diff --git a/tests/augmentation/container/test_augmentation_sequential.py b/tests/augmentation/container/test_augmentation_sequential.pyindex d6205b4ca..fec1f6402 100644--- a/tests/augmentation/container/test_augmentation_sequential.py+++ b/tests/augmentation/container/test_augmentation_sequential.py@@ -25,6 +25,7 @@ import korniaimport kornia.augmentation as Kfrom kornia.augmentation.container.base import ParamItemfrom kornia.constants import BorderType+from kornia.core._compat import torch_version_ltfrom kornia.geometry.bbox import bbox_to_maskfrom testing.augmentation.utils import reproducibility_test@@ -111,6 +112,8 @@ class TestAugmentationSequential:def test_mixed_image_bbox_dtypes(self, device, image_dtype):# Regression test for https://github.com/kornia/kornia/issues/3705 and #3706:# bbox stays in fp32 while the image uses a half/double compute dtype.+ if device.type == "cpu" and image_dtype in (torch.float16, torch.bfloat16) and torch_version_lt(2, 6, 0):+ pytest.skip("PyTorch <2.6 has no CPU Half/BFloat16 grid_sample kernel")torch.manual_seed(0)img = torch.rand(2, 3, 32, 32, device=device, dtype=image_dtype)bb = torch.tensor(diff --git a/tests/augmentation/test_torch_export.py b/tests/augmentation/test_torch_export.pyindex 9464e1382..5b202f520 100644--- a/tests/augmentation/test_torch_export.py+++ b/tests/augmentation/test_torch_export.py@@ -23,15 +23,13 @@ TorchGeo migrated its inference-time transforms off kornia onto ``torchvision.trciting exactly this gap ("kornia augmentations can't be torch.exported").The augmentation base ``forward`` stashes per-call state on ``self`` (``_params`` and the lazy-transform matrix), which ``torch.export`` on torch <= 2.9 rejects ("attrs created in forward" /-pytree "Node arity mismatch"). Those side effects are now skipped under ``torch.export`` (the-captured image output is unchanged), so the deterministic transforms export cleanly and-numerically match eager. This pins that so it does not regress.--Only *deterministic single* transforms are covered β random augmentations sample parameters-during capture in ways that don't line up with a separate eager call (RNG bookkeeping), and-``AugmentationSequential`` containers still stash their own per-call state and are not export-clean-yet.+transform matrix). ``torch.compiler.is_exporting`` lets the base skip those side effects during+``torch.export`` capture without changing the captured image output. This capability was added in+torch 2.7, so the tests are skipped on earlier versions.++The cases cover deterministic single transforms and ``AugmentationSequential`` containers. Random+augmentations that sample parameters during capture are excluded because their RNG bookkeeping does+not line up with a separate eager call."""from __future__ import annotations@@ -43,6 +41,11 @@ import torchimport kornia.augmentation as K+from testing.base import DYNAMO_UNAVAILABLE_REASON, dynamo_is_available++_HAS_TORCH_EXPORT_TRACKING = hasattr(torch, "compiler") and hasattr(torch.compiler, "is_exporting")+_TORCH_EXPORT_TRACKING_REASON = "torch.export tracking requires torch.compiler.is_exporting (torch>=2.7)"+def _normalize() -> torch.nn.Module:return K.Normalize(mean=torch.zeros(3), std=torch.ones(3))@@ -74,6 +77,8 @@ TORCH_EXPORT_DETERMINISTIC: list[Tuple[str, Callable[[], torch.nn.Module]]] = [@pytest.mark.skipif(not hasattr(torch, "export"), reason="torch.export requires torch>=2.1")[email protected](not dynamo_is_available(), reason=DYNAMO_UNAVAILABLE_REASON)[email protected](not _HAS_TORCH_EXPORT_TRACKING, reason=_TORCH_EXPORT_TRACKING_REASON)@pytest.mark.parametrize("name,factory", TORCH_EXPORT_DETERMINISTIC, ids=[n for n, _ in TORCH_EXPORT_DETERMINISTIC])def test_torch_export_deterministic(name: str, factory: Callable[[], torch.nn.Module]) -> None:"""Deterministic inference transform captures via ``torch.export`` and matches eager."""@@ -116,6 +121,8 @@ TORCH_EXPORT_CONTAINERS: list[Tuple[str, Callable[[], torch.nn.Module]]] = [@pytest.mark.skipif(not hasattr(torch, "export"), reason="torch.export requires torch>=2.1")[email protected](not dynamo_is_available(), reason=DYNAMO_UNAVAILABLE_REASON)[email protected](not _HAS_TORCH_EXPORT_TRACKING, reason=_TORCH_EXPORT_TRACKING_REASON)@pytest.mark.parametrize("name,factory", TORCH_EXPORT_CONTAINERS, ids=[n for n, _ in TORCH_EXPORT_CONTAINERS])def test_torch_export_container(name: str, factory: Callable[[], torch.nn.Module]) -> None:"""A deterministic ``AugmentationSequential`` pipeline captures via ``torch.export`` and matches eager."""diff --git a/tests/geometry/test_conversions.py b/tests/geometry/test_conversions.pyindex 3e15dc341..211752bcf 100644--- a/tests/geometry/test_conversions.py+++ b/tests/geometry/test_conversions.py@@ -50,7 +50,7 @@ from kornia.geometry.conversions import ()from kornia.geometry.quaternion import Quaternion-from testing.base import BaseTester, assert_close+from testing.base import DYNAMO_UNAVAILABLE_REASON, BaseTester, assert_close, dynamo_is_available@pytest.fixture()@@ -3459,6 +3459,7 @@ def test_pixel_coordinate_singleton_policy_scripts(op_name, args, device, dtype)("denormalize_pixel_coordinates3d", 3),],)[email protected](not dynamo_is_available(), reason=DYNAMO_UNAVAILABLE_REASON)def test_pixel_coordinate_export_crosses_singleton_boundary(op_name, ndim):op = getattr(kornia.geometry.conversions, op_name)@@ -3523,6 +3524,7 @@ def test_non_default_eps_does_not_break_fullgraph_compile(op_name, sizes):],ids=["float32", "bfloat16-rounding-boundary", "float16-rounding-boundary"],)[email protected](not dynamo_is_available(), reason=DYNAMO_UNAVAILABLE_REASON)def test_normal_transform_export_crosses_singleton_boundary(is_3d, dtype, runtime_sizes):class ExportTransform(torch.nn.Module):def forward(self, image):diff --git a/tests/geometry/test_grid.py b/tests/geometry/test_grid.pyindex 8f03bce48..a560c9f6e 100644--- a/tests/geometry/test_grid.py+++ b/tests/geometry/test_grid.py@@ -20,7 +20,7 @@ import torchimport kornia-from testing.base import assert_close+from testing.base import DYNAMO_UNAVAILABLE_REASON, assert_close, dynamo_is_availabledef test_create_meshgrid(device, dtype):@@ -169,6 +169,7 @@ def test_normalized_meshgrid_trace_matches_eager_at_unrepresentable_sizes(is_3d,@pytest.mark.parametrize("normalized_coordinates", [False, True], ids=["pixel", "normalized"])@pytest.mark.parametrize("is_3d", [False, True], ids=["2d", "3d"])[email protected](not dynamo_is_available(), reason=DYNAMO_UNAVAILABLE_REASON)def test_meshgrid_export_crosses_singleton_boundary(is_3d, normalized_coordinates):class MeshGrid(torch.nn.Module):def forward(self, image):