mars.tensor.column_stack#

mars.tensor.column_stack(tup)[source]#

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.

Parameters

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

Returns

stacked – The tensor formed by stacking the given tensors.

Return type

2-D tensor

Examples

>>> 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]])