brainstate.transform.unvmap#
- brainstate.transform.unvmap(x, op='any')#
Remove a leading vmap dimension by aggregating batched values.
- Parameters:
x (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – A single array value produced inside ajax.vmap()-transformed function. The reductions bind a JAX primitive and accept only one array; pytrees are not supported.op (
str) – Reduction to apply across the vmapped axis.'none'returnsxwithout reduction, while'max'computes the maximum element.
- Returns:
Result of applying the requested reduction with vmap metadata removed.
- Return type:
- Raises:
ValueError – If
opis not one of'all','any','none', or'max'.
Examples
>>> import jax.numpy as jnp >>> import brainstate >>> >>> xs = jnp.array([[True, False], [True, True]]) >>> brainstate.transform.unvmap(xs, op='all')