t3toolbox.corewise.corewise_sub#

t3toolbox.corewise.corewise_sub(X: NDArrayTree, Y: NDArrayTree) NDArrayTree#

Subtract 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_sub(X, Y))
(array([-1., -1., -1.]), (-2, (), array([2., 2.])))