Batching test policy#
This page records what 0.4.0 tests about batching and what it intentionally
does not. The mathematical batching model is Batching and Vectorization; this page is
about test scope.
0.4.0 does not redesign batching. ADR-006 is the contract; this release
stabilizes it through coverage rather than reshaping it. Any redesign is
out of scope and is tracked separately in docs/dev/current.md.
In scope#
The following behavior is exercised by the generated test suite and by backend conformance tests:
LinOp.vapplyandLinOp.rvapplyover a leading-axis batch with shape(B,) + space.shape, including the degenerateB = 1case.Functional.vvalueandFunctional.vgradwhere implemented, against per-row reference computations.StackedSpaceas a first-class space, including arithmetic, inner products, capabilities, andcheck_level-aware leaf checks.TreeSpaceblock operators on batched leaves where every leaf carries the same leading-axis batch shape.Native JAX
vmapparity with the backend-agnostic loop fallback for operations declared as batchable in the backend conformance matrix (Backend conformance).Trailing-shape and dtype validation under each
check_level, including the bounded probes used by"strict".
Out of scope for 0.4.0#
The following cases are intentionally not tested as part of the release gate.
A defect found here is documented in docs/dev/current.md and tracked for
a future release rather than fixed in 0.4.0:
Nested batch axes (more than one leading batch dimension).
Non-leading batch axes.
Mixed leaf batch sizes within a single
TreeSpaceelement.Cross-backend batched conformance beyond NumPy and JAX. Torch and CuPy batched paths are exercised opportunistically through generators but are not subject to the strict tolerance pins applied to NumPy and JAX.
Batched iterative solvers (
cg,lsqr,lanczos_smallest,power_iteration,expm_multiply). These entry points are unbatched in0.4.0and must raise a clear shape error on batched input; choosing between explicit batched APIs and a documented user-level loop is deferred to a follow-up.
Where the tests live#
tests/linops/test_batched_apply.pyandtests/linops/test_batched_lifting.py— leading-axisvapply/rvapplyand structured-operator batched paths.tests/linops/test_tree_linop_batching.py— batchedTreeSpaceblock operators.tests/spaces/test_vectorized_checks.py— trailing-shape and dtype validation under eachcheck_level.tests/spaces/test_stacked_space.py—StackedSpacearithmetic, inner products, and capability dispatch.tests/backend/test_backend_vmap.py— nativevmapvs fallback-loop parity (Phase J9; see Backend conformance).
Generator families that produce batched cases live under tests/generators/
and include dense_coordinate_space_cases, tree_space_generated_cases,
and the LinOp generators in tests/generators/linops.py. Each generator
documents whether it produces batched, unbatched, or both variants.
Reading this policy#
This page is not a redesign proposal. It is a statement of which behavior is
under contract for 0.4.0 and which is allowed to drift. When the
batching design itself evolves, the new contract belongs in ADR-006 (or its
successor) and is reflected in Batching and Vectorization. This page only updates when
the test scope changes.