fn

hstack

Tensor
hstack(tensors: list[Tensor])
source

Stack tensors horizontally (column-wise).

For 1-D inputs this concatenates along axis 0; for higher rank inputs it concatenates along axis 1. Convenience wrapper around cat/concat.

Parameters

tensorslist of Tensor
Tensors to stack. Shapes must agree on all axes except the one being concatenated.

Returns

Tensor

Concatenated tensor.

Notes

Mirrors NumPy's hstack behaviour: the axis selection depends on input rank, which can surprise users — prefer cat with an explicit dim when clarity matters.

Examples

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