π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
docs(core): document kornia.core.exceptions (#4798)
Dipak Chaudhari32b250b9a26f
diff --git a/changelog.d/4798.added.md b/changelog.d/4798.added.mdnew file mode 100644index 000000000..640042eb5--- /dev/null+++ b/changelog.d/4798.added.md@@ -0,0 +1 @@+The `kornia.core` API page documents the six exception classes in `kornia.core.exceptions` (`BaseError`, `ShapeError`, `TypeCheckError`, `ValueCheckError`, `DeviceError`, `ImageError`), so references to them from other pages now link.diff --git a/docs/source/core.rst b/docs/source/core.rstindex 47c4eb01f..4b73a2ff4 100644--- a/docs/source/core.rst+++ b/docs/source/core.rst@@ -33,3 +33,33 @@ callable that lets the download half reject a truncated cache entry... autofunction:: load_safetensors.. autofunction:: check_safetensors++Exceptions+----------++.. currentmodule:: kornia.core.exceptions++The errors raised by kornia's ``KORNIA_CHECK*`` validation helpers in+``kornia.core.check`` (and by a few functions directly), such as a tensor with+the wrong shape. All of them derive from :exc:`BaseError`, which derives from+:exc:`Exception`, so ``except BaseError`` catches any of them. It does not catch+every input error: many functions validate their inputs themselves and raise the+built-in :exc:`ValueError` or :exc:`TypeError` instead.++.. autoexception:: BaseError+ :show-inheritance:++.. autoexception:: ShapeError+ :show-inheritance:++.. autoexception:: TypeCheckError+ :show-inheritance:++.. autoexception:: ValueCheckError+ :show-inheritance:++.. autoexception:: DeviceError+ :show-inheritance:++.. autoexception:: ImageError+ :show-inheritance:diff --git a/kornia/core/exceptions.py b/kornia/core/exceptions.pyindex a9a8994ee..486fe3f77 100644--- a/kornia/core/exceptions.py+++ b/kornia/core/exceptions.py@@ -32,7 +32,7 @@ __all__ = [class BaseError(Exception):- """Base exception class for all Kornia errors."""+ """Base class of the exceptions raised by kornia's ``KORNIA_CHECK*`` validation helpers and a few functions."""class ShapeError(BaseError):