#5023·kornia

Keypoints / Keypoints3D advertise list input, to_tensor(as_padded_sequence=True) and Keypoints3D.pad / unpad / transform_keypoints, and every one raises a bare NotImplementedError('')

Author: ducha-aikiCreated Sep 27, 2026Updated Sep 28, 2026

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 Keypoints and Keypoints3D docstrings say keypoints is a "Raw tensor or a list of torch.Tensors", and the constructors are typed Union[Tensor, List[Tensor]]. A list reaches _merge_keypoint_list (kornia/geometry/keypoints.py:28-29), whose whole body is raise 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 is True. The docstring also describes a mode argument that neither method has.
  • Keypoints3D.pad / unpad / transform_keypoints / transform_keypoints_ (:346-379). They are documented with padding_size: (B, 6) and a transformation matrix, and each body is raise NotImplementedError. The transform_keypoints docstring was copied from the 2-D class: it says "2D keypoints" and a (3, 3) matrix.
  • The rst page. docs/source/geometry.keypoints.rst says 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

python
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 Keypoints

kornia 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_keypoints built on transform_points with a (B, 4, 4) matrix;
  • or stop advertising it: narrow the constructor annotation to Tensor, drop as_padded_sequence, and drop or narrow the Keypoints3D methods 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 for get_optical_pose_base / homography_i_H_ref and the sensors.camera models.
  • #4026 (open): VideoKeypoints is importable but not in __all__. It is a neighbouring class, not covered here.

Posted on behalf of @ducha-aiki by Claude (Opus 5.5).