braintools.tree.dot#
- braintools.tree.dot(a, b, is_leaf=<function is_quantity>)[source]#
Inner product over all leaves of two PyTrees.
For each pair of corresponding leaves, compute the elementwise product, reduce with a full sum over all axes, and then sum across leaves.
- Parameters:
- Returns:
Scalar representing the inner product across the entire PyTree.
- Return type:
Array
See also
sumSum of all elements in a PyTree.
squared_normSum of squares of all elements (i.e., dot(x, x)).
Notes
Leaf arrays must be broadcast-compatible for multiplication.
When leaves carry units (brainunit quantities), units propagate through the multiplications and sums according to quantity rules.