mindspore.ops.column_stack
- 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
TypeError – If tensors is not list or tuple.
TypeError – If element in tensors is not Tensor.
ValueError – If tensors is empty.
- 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]]