braintools.tree module#
Operations for manipulating JAX PyTrees, including arithmetic, reshaping, and
conversion utilities used across the toolkit. The functions map over the
leaves of their PyTree arguments; the arithmetic and reduction functions treat
brainunit.Quantity values as leaves by default, so physical units are
preserved.
Arithmetic#
Leaf-wise arithmetic between PyTrees, or between a PyTree and a scalar.
Reductions#
Reduce one or two PyTrees to a single value.
Inner product over all leaves of two PyTrees. |
|
Sum all elements across every leaf in a PyTree. |
|
Sum of squares of all elements in a PyTree. |
Structure and Indexing#
Combine, split, index, and reshape the leaves of a PyTree.
Conversion#
Convert all leaves of a PyTree to NumPy arrays. |