Keypoints / Keypoints3D advertise list input, to_tensor(as_padded_sequence=True) and Keypoints3D.pad / unpad / transform_keypoints, and every one raises a bare NotImplementedError('')
Several entry points on kornia.geometry.keypoints are documented but cannot be used. Each raises NotImplementedError with an empty message, so the traceback does not say what is supported:
- List input. The
KeypointsandKeypoints3Ddocstrings saykeypointsis a "Raw tensor or a list of torch.Tensors", and the constructors are typedUnion[Tensor, List[Tensor]]. A list reaches_merge_keypoint_list(kornia/geometry/keypoints.py:28-29), whose whole body israise NotImplementedError.Keypoints.from_tensor([...])passes its argument to the constructor and fails in the same place. to_tensor(as_padded_sequence=True)on both classes (:222-223,:407-408). The parameter is documented as "whether to keep the pads for a list of keypoints", and the method raises whenever it isTrue. The docstring also describes amodeargument that neither method has.Keypoints3D.pad/unpad/transform_keypoints/transform_keypoints_(:346-379). They are documented withpadding_size: (B, 6)and a transformation matrix, and each body israise NotImplementedError. Thetransform_keypointsdocstring was copied from the 2-D class: it says "2D keypoints" and a(3, 3)matrix.- The rst page.
docs/source/geometry.keypoints.rstsays both classes "wrap a tensor of points and provide transformations and padding".
This is the class #4017 fixed for Boxes. There, trim(), tuple clamp() bounds and translate(method="fast") raised a bare NotImplementedError. #4518 gave those sites corrective messages, and #4017 was closed on 2026-09-27. Its scope was Boxes only, so these Keypoints / Keypoints3D sites are not covered.
The one in-tree consumer of Keypoints3D is already blocked with a message: AugmentationSequential raises "3D keypoint handlers are not yet supported." (kornia/augmentation/container/augment.py:777). Only direct users reach the bare raises.
Reproduction
import torch
from kornia.geometry.keypoints import Keypoints, Keypoints3D
def attempt(label, fn):
try:
out = fn()
print(f"{label:52} -> ok {type(out).__name__}")
except Exception as e:
print(f"{label:52} -> {type(e).__name__}({str(e)!r})")
k2 = torch.ones(1, 2, 2)
k3 = torch.ones(1, 2, 3)
attempt("Keypoints([t1, t2])", lambda: Keypoints([torch.ones(2, 2), torch.ones(3, 2)]))
attempt("Keypoints.from_tensor([t1, t2])", lambda: Keypoints.from_tensor([torch.ones(2, 2), torch.ones(3, 2)]))
attempt("Keypoints(t).to_tensor(as_padded_sequence=True)", lambda: Keypoints(k2).to_tensor(as_padded_sequence=True))
attempt("Keypoints3D([t1, t2])", lambda: Keypoints3D([torch.ones(2, 3), torch.ones(3, 3)]))
attempt("Keypoints3D(t).to_tensor(as_padded_sequence=True)", lambda: Keypoints3D(k3).to_tensor(as_padded_sequence=True))
attempt("Keypoints3D(t).pad(zeros(1, 6))", lambda: Keypoints3D(k3).pad(torch.zeros(1, 6)))
attempt("Keypoints3D(t).unpad(zeros(1, 6))", lambda: Keypoints3D(k3).unpad(torch.zeros(1, 6)))
attempt("Keypoints3D(t).transform_keypoints(eye(4))", lambda: Keypoints3D(k3).transform_keypoints(torch.eye(4)[None]))
attempt("Keypoints3D(t).transform_keypoints_(eye(4))", lambda: Keypoints3D(k3).transform_keypoints_(torch.eye(4)[None]))
attempt("Keypoints(t).pad(zeros(1, 4)) [2-D control]", lambda: Keypoints(k2).pad(torch.zeros(1, 4)))Keypoints([t1, t2]) -> NotImplementedError('')
Keypoints.from_tensor([t1, t2]) -> NotImplementedError('')
Keypoints(t).to_tensor(as_padded_sequence=True) -> NotImplementedError('')
Keypoints3D([t1, t2]) -> NotImplementedError('')
Keypoints3D(t).to_tensor(as_padded_sequence=True) -> NotImplementedError('')
Keypoints3D(t).pad(zeros(1, 6)) -> NotImplementedError('')
Keypoints3D(t).unpad(zeros(1, 6)) -> NotImplementedError('')
Keypoints3D(t).transform_keypoints(eye(4)) -> NotImplementedError('')
Keypoints3D(t).transform_keypoints_(eye(4)) -> NotImplementedError('')
Keypoints(t).pad(zeros(1, 4)) [2-D control] -> ok Keypointskornia main 0fbed00b0, torch 2.14.0 (and 2.5.1: same output), CPU float32, macOS arm64.
Expected
For each site, one of the following:
- implement it: list input padded to the longest sequence, and a 3-D
pad/unpad/transform_keypointsbuilt ontransform_pointswith a(B, 4, 4)matrix; - or stop advertising it: narrow the constructor annotation to
Tensor, dropas_padded_sequence, and drop or narrow theKeypoints3Dmethods and the rst sentence.
Removing a path is an API change, so it goes in the repair window. Until then, the #4518 treatment applies: a message that names what is supported, such as "Keypoints takes an (N, 2) or (B, N, 2) tensor; list input is not implemented", instead of an empty NotImplementedError.
Classification
The documented public paths always raise.
This is the same class as #4017 (tagged idiom 5 there) and the W1b "documented public functions that always raise NotImplementedError" issues #4283 / #4284. Found in the conventions batch 10 audit.
Disposition
Documented as a Known defect in the batch-10 Convention block for Keypoints (with a pointer from Keypoints3D); fix separately. Corrective messages are a focused fix welcome as a PR. Implementing or removing the paths is a repair-window item.
Related
- #4017 (closed): the same class on
Boxes; its corrective messages came in #4518 (merged PR). - #4283 (open) and #4284 (closed): the W1b "documented public ... always raise
NotImplementedError" issues forget_optical_pose_base/homography_i_H_refand thesensors.cameramodels. - #4026 (open):
VideoKeypointsis importable but not in__all__. It is a neighbouring class, not covered here.
Posted on behalf of @ducha-aiki by Claude (Opus 5.5).
Source: kornia/kornia