mindspore.ops.column_stack

View Source On Gitee
mindspore.ops.column_stack(tensors)[source]

Stacks 1-D tensors as columns into a 2-D tensor. Tensors of other dimension are stacked as-is, like mindspore.ops.hstack().

Parameters

tensors (Union[tuple[Tensor], list[Tensor]]) – A sequence of tensors. All of them must have the same shape except the axis to be concatenated.

Returns

2-D Tensor, formed by stacking the given tensors.

Raises
Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor, ops
>>> x1 = Tensor([1, 1, 1])
>>> x2 = Tensor([2, 2, 2])
>>> output = ops.column_stack((x1, x2))
>>> print(output)
[[1 2]
 [1 2]
 [1 2]]