Sweep all 296 v2 modules: simplify verbose docstrings/comments and remove 376 dangling "(design_vN §X)" citations to the now-deleted design docs (v2/README.md is the source of truth). Comment/docstring-only — AST-verified code-identical; the CPU suite holds at 237 passed / 5 pre-existing. Also applies yapf + ruff --fix auto-fixes (import ordering, forward-ref annotation de-quoting under `from __future__ import annotations`; behavior- neutral, suite-confirmed) and adds the legitimate domain terms mot/clen/te to the codespell ignore-list. Remaining ruff (24) + mypy (68 no-untyped-call) findings are pre-existing v2 debt, untouched here.
21 lines
721 B
Python
21 lines
721 B
Python
"""Shared lightweight type aliases for v2.
|
|
|
|
The core (card/loop/runtime/cache/parity/program/request/training) is numpy-only
|
|
and CPU-testable, so tensors are typed structurally as ``TensorLike``: a
|
|
``numpy.ndarray`` on the CPU test path, a ``torch.Tensor`` on GPU. The core never
|
|
imports torch — only model-component adapters do, lazily (see
|
|
``v2/card/components.py``).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
# A tensor-like object. numpy.ndarray (CPU tests) or torch.Tensor (GPU). The core
|
|
# only relies on duck-typed ops provided by the active backend (see card/backend).
|
|
TensorLike = Any
|
|
|
|
Shape = tuple[int, ...]
|
|
|
|
# A stable content hash (hex) used for cache keys and provenance.
|
|
Hash = str
|