Split a tensor into multiple sub-tensors.
ary (Tensor) – Tensor to be divided into sub-tensors.
indices_or_sections (int or 1-D tensor) –
If indices_or_sections is an integer, N, the array will be divided
into N equal tensors along axis. If such a split is not possible,
an error is raised.
If indices_or_sections is a 1-D tensor of sorted integers, the entries
indicate where along axis the array is split. For example,
[2, 3] would, for axis=0, result in
If an index exceeds the dimension of the tensor along axis,
an empty sub-tensor is returned correspondingly.
axis (int, optional) – The axis along which to split, default is 0.
sub-tensors – A list of sub-tensors.
list of Tensors
ValueError – If indices_or_sections is given as an integer, but
a split does not result in equal division.
Split a tensor into multiple sub-tensors of equal or near-equal size. Does not raise an exception if an equal division cannot be made.
Split into multiple sub-arrays horizontally (column-wise).
Split tensor into multiple sub-tensors vertically (row wise).
Split tensor into multiple sub-tensors along the 3rd axis (depth).
Join a sequence of tensors along an existing axis.
Join a sequence of tensors along a new axis.
Stack tensors in sequence horizontally (column wise).
Stack tensors in sequence vertically (row wise).
Stack tensors in sequence depth wise (along third dimension).
>>> import mars.tensor as mt
>>> x = mt.arange(9.0)
>>> mt.split(x, 3).execute()
[array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7., 8.])]
>>> x = mt.arange(8.0)
>>> mt.split(x, [3, 5, 6, 10]).execute()
[array([ 0., 1., 2.]),
array([ 3., 4.]),
array([ 6., 7.]),