oneflow.column_stack

oneflow.column_stack(tensors)Tensor

Creates a new tensor by horizontally stacking the tensors in tensors.

Equivalent to oneflow.hstack(tensors), tensors with dimensions less than 2 will be reshaped to (t.numel(), 1) before being stacked horizontally.

The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.column_stack.html.

Parameters

tensors – (List[oneflow.Tensor]): sequence of tensors to stack

Returns

A Tensor

For example:

>>> import oneflow as flow
>>> x1 = flow.randn(5)
>>> x2 = flow.randn(5)
>>> flow.column_stack([x1, x2]).shape
oneflow.Size([5, 2])
>>> x1 = flow.randn(2, 5)
>>> x2 = flow.randn(2, 2)
>>> flow.column_stack([x1, x2]).shape
oneflow.Size([2, 7])