jaxrens.utils.padding

Padding helpers for jax.lax.map(batch_size=N) call sites.

jax.lax.map requires the input’s leading axis to be exactly divisible by batch_size. pad_to_multiple lifts that constraint by repeating the last entry until the leading axis is a multiple of the chunk; callers slice the padding off the output before downstream aggregation.

Functions

pad_to_multiple

Pad a pytree's leading axis up to the next multiple of chunk.