assemble_tucker_variation_jets#
- t3toolbox.backend.sampling_derivatives.assemble_tucker_variation_jets(ztildes, dxi_tildes, ww, pp, etas, n_probe, sum_over_probes, chunk_size=DEFAULT_CHUNK_SIZE)#
def assemble_tucker_variation_jets( ztildes: typ.Sequence[NDArray], # residual jets, len=d, elm_shape=(order+1,)+W+K+C+(Ni,) dxi_tildes: typ.Sequence[NDArray], # adjoint-var-downward jets, len=d, elm_shape=(2,)+W+K+C+(nUi,) ww: typ.Sequence[NDArray], # probe vectors X, len=d, elm_shape=W+(Ni,) pp: typ.Sequence[NDArray], # perturbation vectors P, len=d, elm_shape=W+(Ni,) etas: typ.Sequence[NDArray], # frame downward jets, len=d, elm_shape=(order+1,)+W+C+(nUi,) n_probe: int, # number of sample-stack (W) axes sum_over_probes: bool, chunk_size: typ.Optional[int] = DEFAULT_CHUNK_SIZE, # W-chunk size; None (or >= W) -> dense. See docs/chunking.md ) -> typ.Tuple[NDArray, ...]: # V_tildes. len=d, elm_shape=[W+]K+C+(nUi,Ni)
Assemble the Tucker variation gradient (W-chunked; the per-chunk kernel is
_assemble_tucker_variation_jets_dense()). The milder assembly (two legs nU,N – the dense gradient is a few GB, not the tt-core’s hundreds), chunked over W with the same reducer seam (add if summed, concat if kept) for a uniform chunked-assembly interface. The only twist:ww/pphave no order axis, so W sits at a per-operand axis (2 for the order-carrying jets, 1 for ww/pp).chunk_sizeNone / ragged / multi-W / small W -> runs the dense assembly directly (no chunking).- Parameters:
ztildes (t3toolbox.backend.common.typ.Sequence[NDArray])
dxi_tildes (t3toolbox.backend.common.typ.Sequence[NDArray])
ww (t3toolbox.backend.common.typ.Sequence[NDArray])
pp (t3toolbox.backend.common.typ.Sequence[NDArray])
etas (t3toolbox.backend.common.typ.Sequence[NDArray])
n_probe (int)
sum_over_probes (bool)
chunk_size (t3toolbox.backend.common.typ.Optional[int])
- Return type:
t3toolbox.backend.common.typ.Tuple[NDArray, …]