TuckerTensorTrain.apply_derivatives =================================== .. py:method:: t3toolbox.tucker_tensor_train.TuckerTensorTrain.apply_derivatives(ww, pp, order) .. code-block:: python def apply_derivatives( self, ww: Sequence[NDArray], # apply vectors X, len=d, elm_shape=W+(Ni,) pp: Sequence[NDArray], # perturbation vectors P, len=d, elm_shape=W+(Ni,) order: int, # highest derivative order ) -> NDArray: # shape=(order+1,)+W+C Symmetric directional derivatives of applying this T3 in all modes, in one repeated direction. The all-modes analogue of :py:meth:`probe_derivatives` (derivative analogue of :py:meth:`apply`): ``y^(t) = d^t/ds^t apply(X + s P)|_0`` for ``t=0..order`` (a scalar per stack element). Stacks ``order + W + C``. ``X`` and ``P`` share the sample stack ``W``. .. seealso:: :py:obj:`apply`, :py:obj:`probe_derivatives`, :py:obj:`apply_corewise_derivatives_transpose` .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> np.random.seed(0) >>> x = t3.TuckerTensorTrain.randn((14, 15, 16), (4, 5, 6), (1, 3, 2, 1)) >>> ww = (np.random.randn(14), np.random.randn(15), np.random.randn(16)) >>> pp = (np.random.randn(14), np.random.randn(15), np.random.randn(16)) >>> yj = x.apply_derivatives(ww, pp, 3) >>> print(yj.shape) # (order+1,) (4,) >>> print(bool(np.allclose(yj[0], x.apply(ww)))) # order 0 == apply True