fn

column_stack

Tensor
column_stack(tensors: Sequence[Tensor])
source

Stack tensors as columns of a 2-D matrix.

Each 1-D tensor is first promoted to a column vector of shape (N, 1); tensors with rank >= 2 are passed through unchanged. The results are then concatenated along axis 1.

Parameters

tensorsSequence[Tensor]
Tensors to stack. 1-D tensors are reshaped to column form; higher-rank tensors must already have matching first-axis size.

Returns

Tensor

2-D tensor formed by concatenating the (possibly promoted) inputs along axis 1.

Notes

For all-1-D inputs v(1),,v(k)v^{(1)}, \dots, v^{(k)} of length N, the result has shape (N, k):

outij=vi(j).\text{out}_{ij} = v^{(j)}_i.

For higher-rank inputs, the first dimension is the "row count" along which axis-1 concatenation happens, matching NumPy semantics.

Examples

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