Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix doctest warnings (#3632)

Dmytro Mishkin37ac9674e1ab
diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml
index af841f7c7..30154084e 100644
--- a/.github/workflows/tutorials.yml
+++ b/.github/workflows/tutorials.yml
@@ -64,6 +64,9 @@ jobs:
PIP_EXTRA_INDEX_URL: "https://pypi.org/simple"
run: make setup
+ - name: Install local kornia
+ run: pip install -e . --no-deps
+
- name: Check deps
working-directory: ./tutorials-repo/
run: make check-deps
diff --git a/CLAUDE.md b/CLAUDE.md
index d11ab140a..7331ec3c1 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -86,6 +86,7 @@ class TestMyFunction(BaseTester):
def test_smoke(self, device, dtype): ... # Basic run with all arg combinations
def test_exception(self, device, dtype): ... # Exception cases
def test_cardinality(self, device, dtype): ... # Output shapes
+ def test_feature(self, device, dtype): ... # Correctness / numerical accuracy
def test_gradcheck(self, device): ... # Gradient checking via self.gradcheck()
def test_dynamo(self, device, dtype, torch_optimizer): ... # torch.compile compat
```
@@ -105,3 +106,14 @@ The `device` and `dtype` fixtures are injected automatically. Use `self.assert_c
## Pre-commit Hooks
Install hooks with `pre-commit install`. CI enforces ruff formatting, linting, and docformatter.
+
+## PR Requirements
+
+All PRs must:
+- Be linked to a previously discussed GitHub issue or Discord discussion (`Fixes #123`)
+- Include pasted local test log output as proof of execution (`pixi run test ...`)
+- Reference an algorithm source (PyTorch, OpenCV, scikit-image, paper, etc.) for any new implementation
+
+**Comments**: No redundant or ghost comments (e.g., "this returns the input tensor", or comments explaining deleted code). Violation triggers mandatory manual rewrite request.
+
+See `AI_POLICY.md` for the full contribution policy, including AI usage disclosure requirements.
diff --git a/docs/source/enhance.rst b/docs/source/enhance.rst
index 287bdf042..3221fa967 100644
--- a/docs/source/enhance.rst
+++ b/docs/source/enhance.rst
@@ -32,7 +32,7 @@ Interactive Demo
<gradio-app src="kornia/kornia-image-enhancement"></gradio-app>
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/kornia-image-enhancement>`_.
+Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/kornia/kornia-image-enhancement>`__.
Equalization
------------
@@ -47,7 +47,7 @@ Interactive Demo
<gradio-app src="Iamabhipandat/kornia-image-equalization"></gradio-app>
-Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/Iamabhipandat/kornia-image-equalization>`_.
+Visit the demo on `Hugging Face Spaces <https://huggingface.co/spaces/Iamabhipandat/kornia-image-equalization>`__.
.. autofunction:: histogram
diff --git a/kornia/losses/__init__.py b/kornia/losses/__init__.py
index 310b30fc8..1f2666b78 100644
--- a/kornia/losses/__init__.py
+++ b/kornia/losses/__init__.py
@@ -49,6 +49,7 @@ from .mutual_information import (
normalized_mutual_information_loss_2d,
normalized_mutual_information_loss_3d,
)
+from .one_hot import one_hot
from .psnr import PSNRLoss, psnr_loss
from .ssim import SSIMLoss, ssim_loss
from .ssim3d import SSIM3DLoss, ssim3d_loss
@@ -99,6 +100,7 @@ __all__ = [
"normalized_mutual_information_loss",
"normalized_mutual_information_loss_2d",
"normalized_mutual_information_loss_3d",
+ "one_hot",
"psnr_loss",
"ssim3d_loss",
"ssim_loss",