pack_vectors#

t3toolbox.backend.ut3_operations.pack_vectors(unpacked_vectors, N=None)#
def pack_vectors(
        unpacked_vectors: typ.Sequence[NDArray],  # len=d, ith elm_shape=stack_shape+(Ni,)
        N: int = None,                            # padded length (default max(Ni))
) -> NDArray:                                     # packed, shape=(d,)+stack_shape+(N,)

Zero-pad and stack a sequence of (ragged-length) vectors into one supercore-shaped tensor.

The pad fill is zeros, and must stay FINITE: masking works by multiplication, and 0 * nan = nan – a nan/inf fill would poison masked reductions downstream (docs/uniform_equivalence_contract.md). Shape information always travels alongside the packed array; the fill is never used to infer shape.

Parameters:
  • unpacked_vectors (t3toolbox.backend.common.typ.Sequence[NDArray])

  • N (int)

Return type:

NDArray