fn

row_stack

Tensor
row_stack(tensors: Sequence[Tensor])
source

Stack tensors as rows — alias of lucid.vstack.

Verbose name provided for API parity. Each 1-D input is treated as a row and concatenated along axis 0.

Parameters

tensorsSequence[Tensor]
Tensors to stack. 1-D tensors are promoted to (1, N) row vectors; higher-rank tensors must have matching column count.

Returns

Tensor

Tensor formed by concatenating the (possibly promoted) inputs along axis 0.

Notes

For all-1-D inputs of length N, the result has shape (k, N):

outij=vj(i).\text{out}_{ij} = v^{(i)}_j.

The 1-D-to-2-D promotion is the inverse of column_stack's promotion.

Examples

>>> import lucid
>>> a = lucid.tensor([1., 2., 3.])
>>> b = lucid.tensor([4., 5., 6.])
>>> lucid.row_stack([a, b])
Tensor([[1., 2., 3.],
        [4., 5., 6.]])