Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs: present the export survey as a dated measurement, not a support statement (#5820)

Dmytro Mishkin0b4131563c7f
diff --git a/changelog.d/5820.added.md b/changelog.d/5820.added.md
new file mode 100644
index 000000000..4a63ae5da
--- /dev/null
+++ b/changelog.d/5820.added.md
@@ -0,0 +1,4 @@
+The ONNX, torch.compile and torch.export page is now presented as a dated survey rather than a support statement:
+it is titled a survey, opens with a note that it records one measurement that Kornia's tests check only in part,
+and reports *passed / probed* instead of *supported / probed*. The ONNX guide no longer quotes the share of
+operators that export.
diff --git a/docs/export_support/README.md b/docs/export_support/README.md
index 9537d2614..607e9d3e4 100644
--- a/docs/export_support/README.md
+++ b/docs/export_support/README.md
@@ -1,6 +1,6 @@
-# Graph-capture survey behind the support page
+# Graph-capture survey behind the survey page
-The [ONNX, torch.compile and torch.export support](../source/get-started/index.rst) page of the
+The [ONNX, torch.compile and torch.export survey](../source/get-started/index.rst) page of the
documentation is rendered from `docs/source/_data/export_support.json`, a committed snapshot of
what this directory measures. The page itself is generated at docs build time by
`docs/generate_export_support.py`; nothing here runs during a docs build.
diff --git a/docs/export_support/harness.py b/docs/export_support/harness.py
index 7928e5412..72f6eacb6 100644
--- a/docs/export_support/harness.py
+++ b/docs/export_support/harness.py
@@ -16,7 +16,7 @@
#
"""Shared harness of the library-wide graph-capture survey behind the ONNX / torch.compile / torch.export
-support page (docs/source/get-started/export-support.rst, rendered by docs/generate_export_support.py).
+survey page (docs/source/get-started/export-support.rst, rendered by docs/generate_export_support.py).
A *case* is one public kornia callable (function or nn.Module instance) plus a concrete set of
tensor inputs. Every tensor input becomes an ONNX graph input; Python-only kwargs are baked into
diff --git a/docs/export_support/run.py b/docs/export_support/run.py
index b4b942e40..95ee50327 100644
--- a/docs/export_support/run.py
+++ b/docs/export_support/run.py
@@ -15,7 +15,7 @@
# limitations under the License.
#
-"""Regenerate the snapshot behind the ONNX / torch.compile / torch.export support page.
+"""Regenerate the snapshot behind the ONNX / torch.compile / torch.export survey page.
Usage (from the repository root, with the docs built once so cross-references resolve):
diff --git a/docs/generate_export_support.py b/docs/generate_export_support.py
index 1ae52f20f..e1ce24bd8 100644
--- a/docs/generate_export_support.py
+++ b/docs/generate_export_support.py
@@ -20,7 +20,7 @@
The JSON is a committed snapshot of the graph-capture survey in ``docs/export_support/``: every public
operator, model and augmentation probed with the dynamo ONNX exporter, ``torch.export`` and
``torch.compile``. Refresh it with ``python docs/export_support/run.py`` (see that package's README)
-and commit the result; this module turns it into the support page at docs-build time, the same way
+and commit the result; this module turns it into the survey page at docs-build time, the same way
``generate_adoption.py`` renders the Adoption page.
"""
@@ -282,8 +282,9 @@ def render_page(data: dict) -> str:
)
ops = _operator_counts(cases)
description = (
- f"Which Kornia operators export to ONNX, capture with torch.export and run under torch.compile: "
- f"{len(cases)} probed configurations across {len(packages)} packages, with the reason for every failure."
+ f"A dated survey of which Kornia operators exported to ONNX, captured with torch.export and ran under "
+ f"torch.compile: {len(cases)} probed configurations across {len(packages)} packages, with the reason for "
+ f"every failure. A measurement, not a support guarantee."
)
sections = []
@@ -297,7 +298,7 @@ def render_page(data: dict) -> str:
n_fail[key] += 1
lead = (
f"{len(cs)} probed configurations. ONNX {_ratio(n['onnx'])}, torch.export {_ratio(n['export'])}, "
- f"torch.compile {_ratio(n['compile'])} (supported / probed)."
+ f"torch.compile {_ratio(n['compile'])} (passed / probed)."
)
block = [f".. _export-support-{_slug(pkg)}:", "", pkg, "-" * len(pkg), "", lead, ""]
parts = _package_sections(cs)
@@ -323,8 +324,8 @@ def render_page(data: dict) -> str:
.. _export-support:
-ONNX, torch.compile and torch.export support
-============================================
+ONNX, torch.compile and torch.export survey
+===========================================
.. meta::
:description: {description}
@@ -334,6 +335,13 @@ paths PyTorch offers, and this page lists the result for each one, package by pa
cause of every failure. Use the search box to find an operator, or the summary table to jump to a
package.
+.. note::
+
+ This page records one measurement, not a support guarantee. It was taken on {data.get("generated_at", "")}
+ with torch {data.get("torch", "")}, and Kornia's test suite checks only part of what it lists as working, so
+ an entry may no longer hold for the current release. Export or compile your own pipeline and compare it with
+ eager before relying on it.
+
.. grid:: 1 3 3 3
:gutter: 3
:class-container: kornia-cards kornia-compat-cards
@@ -366,7 +374,7 @@ package.
``torch.compile`` with the default inductor backend, compared with eager; graph breaks counted
-Each figure is *supported / probed*; {n_ok_all} of the {len(cases)} probed configurations pass
+Each figure is *passed / probed*; {n_ok_all} of the {len(cases)} probed configurations pass
all three paths; the configurations cover {ops["operators"]} distinct operators, of which
{ops["onnx_operators"]} export to ONNX in at least one configuration. Every operator is captured
with concrete input shapes, so a failure is never about an unknown input size: the causes in the
@@ -383,8 +391,8 @@ in brackets after the operator. Augmentations are probed twice: with their sampl
in as graph inputs (a deterministic graph) and with the sampling inside the graph (``[random]``).
Registry entries that are not tensor graphs at all (file I/O, enums, Python containers, stubs) are
not listed.
-The survey lives in ``docs/export_support/`` and this page is rendered from its committed result,
-so the figures follow the library rather than a hand-maintained list.
+The survey lives in ``docs/export_support/`` and this page is rendered from its committed result;
+nothing refreshes that result automatically.
Legend
------
@@ -396,8 +404,8 @@ Legend
{_legend(cases)}
-A failure on this page is a fact about a specific torch, exporter and kornia version, not a
-promise: most *no* entries are missing ONNX lowerings upstream (``torch.linalg.svd``, ``solve``,
+Every entry on this page, a pass as much as a failure, is a fact about a specific torch, exporter and
+kornia version, not a promise: most *no* entries are missing ONNX lowerings upstream (``torch.linalg.svd``, ``solve``,
``lu_factor``, ``eigh``, ``qr``, ``histc``), data-dependent output sizes (matchers that return a
variable number of pairs, detectors that keep the top-k responses above a threshold, NMS), or
Python control flow that reads tensor values. See :doc:`onnx` for how to chain exported graphs and
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 82dbae1c1..e01f968bc 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -110,8 +110,8 @@ spec = importlib.util.spec_from_file_location("generate_export_support", "../gen
generate_export_support = importlib.util.module_from_spec(spec)
spec.loader.exec_module(generate_export_support)
-# Pre-generate the ONNX / torch.compile / torch.export support page from the committed survey snapshot
-_export_support = generate_export_support.main()
+# Pre-generate the ONNX / torch.compile / torch.export survey page from the committed snapshot
+generate_export_support.main()
def _public_operator_count() -> int:
@@ -169,8 +169,7 @@ def _landing_page_counts() -> dict[str, str]:
package and from the model pages under ``docs/source/models/``. Each count names exactly the
module the card it appears on links to. ``operators-floor`` is the library-wide total from
:func:`_public_operator_count`, floored to the hundred below it so the page can say "1,000+"
- and stay true between releases. The ``onnx-*`` entries come from the export-support survey
- snapshot, counted per operator (supported when at least one probed configuration exports).
+ and stay true between releases.
"""
with open("../../tests/api_surface.json", encoding="utf-8") as handle:
surface = {name: len(names) for name, names in json.load(handle).items()}
@@ -189,13 +188,10 @@ def _landing_page_counts() -> dict[str, str]:
"operators-floor": f"{operators // 100 * 100:,}",
"dependents": f"{_adoption['repositories']:,}",
"dependent-packages": f"{_adoption['packages']:,}",
- "onnx-operators": str(_export_support["operators"]),
- "onnx-exportable": str(_export_support["onnx_operators"]),
- "onnx-share": f"{round(100 * _export_support['onnx_operators'] / _export_support['operators'])}%",
}
-# Substitutions such as |count-geometry| and |count-onnx-share| for the landing and ONNX pages.
+# Substitutions such as |count-geometry| and |count-operators-floor| for the landing page.
rst_epilog = "\n".join(f".. |count-{key}| replace:: {value}" for key, value in _landing_page_counts().items())
# If extensions (or modules to document with autodoc) are in another directory,
diff --git a/docs/source/get-started/edge.rst b/docs/source/get-started/edge.rst
index 2cbe0d327..288ad0824 100644
--- a/docs/source/get-started/edge.rst
+++ b/docs/source/get-started/edge.rst
@@ -10,7 +10,7 @@ resource-constrained targets:
ONNX
----
-Kornia operators and models export to ONNX, and :class:`~kornia.onnx.sequential.ONNXSequential` chains
+Many Kornia operators and models export to ONNX, and :class:`~kornia.onnx.sequential.ONNXSequential` chains
pre-exported graphs into a single model that runs under ONNX Runtime with the CPU, CUDA, TensorRT or OpenVINO
execution providers. Pre-exported operators and models are published in the
`kornia/ONNX_models <https://huggingface.co/kornia/ONNX_models>`_ Hugging Face repository.
diff --git a/docs/source/get-started/index.rst b/docs/source/get-started/index.rst
index 5f3ce4b5e..61e9a626f 100644
--- a/docs/source/get-started/index.rst
+++ b/docs/source/get-started/index.rst
@@ -71,4 +71,4 @@ Looking for a specific function instead? The :doc:`API reference </api>` documen
:hidden:
Tutorials <https://www.kornia.org/tutorials/>
- ONNX, torch.compile & torch.export support <export-support>
+ ONNX, torch.compile & torch.export survey <export-support>
diff --git a/docs/source/get-started/onnx.rst b/docs/source/get-started/onnx.rst
index e8d245005..d718d4aec 100644
--- a/docs/source/get-started/onnx.rst
+++ b/docs/source/get-started/onnx.rst
@@ -15,10 +15,10 @@ runs it with ONNX Runtime. It is useful when you have pre-exported operators or
- **Execution providers**: run on CPU, CUDA, TensorRT or OpenVINO through ONNX Runtime, with control over the
session options.
-Most of the library exports: |count-onnx-share| of Kornia's public operators (|count-onnx-exportable| of the
-|count-onnx-operators| surveyed) go through ``torch.onnx.export`` and run under ONNX Runtime. The
-:ref:`ONNX, torch.compile and torch.export support <export-support>` page lists the outcome for every operator,
-model and augmentation, with the cause of each failure.
+The :ref:`ONNX, torch.compile and torch.export survey <export-support>` records whether each operator, model
+and augmentation exported in one dated measurement, with the cause of each failure. It is a snapshot, not a
+support guarantee, and Kornia's tests check only part of it: export your own pipeline and compare it with eager
+before relying on it.
Quickstart
----------
@@ -179,8 +179,9 @@ Use the ``io_maps`` argument to say which output feeds which input.
Yes, pass your own session options to the ``create_session`` method.
**Which operators export?**
-The :ref:`ONNX, torch.compile and torch.export support <export-support>` page lists every surveyed operator with
-its ONNX export, ``torch.export`` and ``torch.compile`` outcome, searchable by name and filterable by result.
+The :ref:`ONNX, torch.compile and torch.export survey <export-support>` lists every surveyed operator with
+its ONNX export, ``torch.export`` and ``torch.compile`` outcome in one dated measurement, searchable by name and
+filterable by result. Treat an entry as a starting point, not a guarantee.
**Where are the pre-exported Kornia operators?**
In the `kornia/ONNX_models <https://huggingface.co/kornia/ONNX_models>`_ Hugging Face repository; load them with