jax.ops package¶
Indexed update operators¶
JAX is intended to be used with a functional style of programming, and does not support NumPy-style indexed assignment directly. Instead, JAX provides alternative pure functional operators for indexed updates to arrays.
JAX array types have a property at, which can be used as
follows (where idx is a NumPy index expression).
Alternate syntax |
Equivalent in-place expression |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
None of these expressions modify the original x; instead they return
a modified copy of x. However, inside a jit() compiled function,
expressions like x = x.at[idx].set(y) are guaranteed to be applied inplace.
Indexed update functions (deprecated)¶
The following functions are aliases for the x.at[idx].set(y)
style operators. Prefer to use the x.at[idx] operators instead.
Helper object for building indexes for indexed update functions. |
|
|
Pure equivalent of |
|
Pure equivalent of |
|
Pure equivalent of |
|
Pure equivalent of |
|
Pure equivalent of |
Other operators¶
|
Computes the maximum within segments of an array. |
|
Computes the minimum within segments of an array. |
|
Computes the product within segments of an array. |
|
Computes the sum within segments of an array. |