Batch-Aware Attention For The Eager Trainer #
This module supplies the eager implementation used by the generic Ops instance for a leading
batch axis. The CPU path fixes the semantics by mapping the existing single-sample operation. The
CUDA path folds batch and head axes into one native launch while retaining TorchLean's local VJP.
CPU reference path for batch-aware attention.
It records the established single-sample attention node for each entry of the leading axis. The CUDA path below can execute those samples together, while this definition fixes the exact per-sample forward and backward meaning.
Instances For
Batch-aware eager attention with a TorchLean-owned local VJP.
The CUDA executor folds (batch, head) into one BMM batch axis. Provider selection remains
explicit, and the checked default uses TorchLean's hard-masked softmax and backward rule.