mars.tensor.column_stack

mars.tensor.column_stack(tup)[源代码]

Stack 1-D tensors as columns into a 2-D tensor.

Take a sequence of 1-D tensors and stack them as columns to make a single 2-D tensor. 2-D tensors are stacked as-is, just like with hstack. 1-D tensors are turned into 2-D columns first.

参数

tup (sequence of 1-D or 2-D tensors.) – Tensors to stack. All of them must have the same first dimension.

返回

stacked – The tensor formed by stacking the given tensors.

返回类型

2-D tensor

实际案例

>>> import mars.tensor as mt
>>> a = mt.array((1,2,3))
>>> b = mt.array((2,3,4))
>>> mt.column_stack((a,b)).execute()
array([[1, 2],
       [2, 3],
       [3, 4]])