corewise_map ============ .. py:function:: t3toolbox.corewise.corewise_map(f, *Xs) .. code-block:: python def corewise_map( f, # callable applied to matching leaves: f(leaf_X0, leaf_X1, ...) -> leaf *Xs: NDArrayTree, # one or more identically-structured trees ) -> NDArrayTree: # tree of f-results, same structure as the inputs Apply ``f`` elementwise over the leaves of one or more identically-structured trees (the general tree map the corewise ops are special cases of; used e.g. for an Adam moment update over the cores). .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.corewise as cw >>> X = (np.ones(2), (3.0,)) >>> print(cw.corewise_map(lambda x: x + 1, X)) (array([2., 2.]), (4.0,)) >>> print(cw.corewise_map(lambda a, b: a * b, X, X)) (array([1., 1.]), (9.0,))