traveler.core.typing.get_hinted_shape#

traveler.core.typing.get_hinted_shape(annotation)[source]#

Extract named dimensions and minimum rank from a jaxtyping annotation.

Parameters:

annotation (jaxtyping array annotation or None) – Annotation whose dimension specification should be inspected.

Returns:

  • dict[int, str] – Mapping from dimension positions to their declared names. Negative positions identify named dimensions after a variadic dimension.

  • int – Minimum number of dimensions required by the annotation.

Raises:

ValueError – If an abstract array annotation does not expose dimension metadata.

Return type:

tuple[dict[int, str], int]