mars.tensor.concatenate¶

mars.tensor.
concatenate
(tensors, axis=0)[source]¶ Join a sequence of arrays along an existing axis.
 Parameters
a1 (sequence of array_like) – The tensors must have the same shape, except in the dimension corresponding to axis (the first, by default).
a2 (sequence of array_like) – The tensors must have the same shape, except in the dimension corresponding to axis (the first, by default).
.. (sequence of array_like) – The tensors must have the same shape, except in the dimension corresponding to axis (the first, by default).
axis (int, optional) – The axis along which the tensors will be joined. Default is 0.
 Returns
res – The concatenated tensor.
 Return type
Tensor
See also
array_split
Split a tensor into multiple subarrays of equal or nearequal size.
split
Split tensor into a list of multiple subtensors of equal size.
hsplit
Split tensor into multiple subtensors horizontally (column wise)
vsplit
Split tensor into multiple subtensors vertically (row wise)
dsplit
Split tensor into multiple subtensors along the 3rd axis (depth).
stack
Stack a sequence of tensors along a new axis.
hstack
Stack tensors in sequence horizontally (column wise)
vstack
Stack tensors in sequence vertically (row wise)
dstack
Stack tensors in sequence depth wise (along third dimension)
Examples
>>> import mars.tensor as mt
>>> a = mt.array([[1, 2], [3, 4]]) >>> b = mt.array([[5, 6]]) >>> mt.concatenate((a, b), axis=0).execute() array([[1, 2], [3, 4], [5, 6]]) >>> mt.concatenate((a, b.T), axis=1).execute() array([[1, 2, 5], [3, 4, 6]])