brainstate.transform.pmap2

Contents

brainstate.transform.pmap2#

brainstate.transform.pmap2(fn=<brainstate.typing.Missing object>, axis_name=None, *, in_axes=0, out_axes=0, static_broadcasted_argnums=(), devices=None, backend=None, axis_size=None, donate_argnums=(), global_arg_shapes=None, state_in_axes=None, state_out_axes=None, unexpected_out_state_mapping='auto')#

Parallel-map a callable across devices with state-aware semantics.

This mirrors jax.pmap() but integrates with StatefulMapping so State objects (including random states) are replicated, split, and restored correctly on every device. When fn is omitted a decorator is returned.

Parameters:
Returns:

A StatefulMapping executing fn over devices, or a decorator.

Return type:

Callable[[TypeVar(F, bound= Callable)], TypeVar(F, bound= Callable)] | TypeVar(F, bound= Callable)

See also

jax.pmap

Underlying JAX primitive.

brainstate.transform.vmap2

Single-host vectorisation with the same semantics.