sum_leafs_along_axes ==================== .. py:function:: t3toolbox.backend.stacking.sum_leafs_along_axes(S, axes) .. code-block:: python def sum_leafs_along_axes( S, # tree of NDArrays (or single NDArray) axes: typ.Union[int, typ.Tuple[int, ...]], # array axes summed in every leaf ): Sum leafs of a tree of NDArrays along specified axes. .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.backend.stacking as stacking >>> A = np.ones((1,2,3,4)) >>> B = np.ones((9,8,7,6,5)) >>> C = np.ones((6,7,6,9)) >>> S = (A, (B,C)) >>> T = stacking.sum_leafs_along_axes(S, (1,3)) >>> (A2, (B2, C2)) = T >>> print(np.linalg.norm(np.sum(A, axis=(1,3)) - A2)) 0.0 >>> print(np.linalg.norm(np.sum(B, axis=(1,3)) - B2)) 0.0 >>> print(np.linalg.norm(np.sum(C, axis=(1,3)) - C2)) 0.0