Expand description
Helpers for batching rules (vmap), shared by the primitives and the
vmap driver in ruxla-transforms.
The rules follow JAX’s batching rules, so that a function batched by ruxla compiles to the same program as one batched by JAX.
Functions§
- batched_
dim - Maps a dimension of one example to the dimension of the batched value
whose batch dimension is
bdim. - bdim_
at_ front - Returns
xwith its batch dimension first, broadcasting it if it is unbatched. - elementwise
- The batching rule of elementwise primitives, whose operands have the same shape: operands batched at the same dimension are used as they are; otherwise every operand is moved (or broadcast) to have its batch dimension first.
- insert_
dim - Returns
dimswithsizeinserted at positionat. - move_
bdim - Returns
xwith its batch dimension atto, broadcasting it if it is unbatched.