Skip to content
fn

vstack

→Tensor
vstack(tensors: Sequence[Tensor])

Implementing kernel

C++ engine symbols that back this Python API.

Stack tensors vertically (row-wise).

1-D inputs are treated as rows of length size; higher-rank inputs are concatenated along axis 0. Convenience wrapper around cat.

Parameters

tensorslist of Tensor
Tensors with compatible shapes.

Returns

Tensor

Concatenated tensor.

Notes

Counterpart to hstack (axis 1) and dstack (axis 2). As with hstack, prefer cat with an explicit dim for clarity in generic-rank code.

Examples

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