corewise_dot#

t3toolbox.corewise.corewise_dot(X, Y)#
def corewise_dot(
        X:  NDArrayTree,  # any nested tree of ints/floats/arrays
        Y:  NDArrayTree,  # same tree structure as X; matching leaf shapes
) -> NDArray:  # X.Y, a scalar (collapses EVERY axis, stacks included)

Dot product of nested objects, X,Y -> X.Y.

Examples

>>> import numpy as np
>>> import t3toolbox.corewise as cw
>>> X = (np.ones(3), (1, (), np.ones(2)))
>>> Y = (2*np.ones(3), (3, (), -np.ones(2)))
>>> print(cw.corewise_dot(X, Y))
7.0
Parameters:
Return type:

NDArray