mindspore.ops.hsplit

View Source On Gitee
mindspore.ops.hsplit(input, indices_or_sections)[source]

Splits a tensor into multiple sub-tensors horizontally. It is equivalent to ops.tensor_split with axis=1 .

Parameters
Returns

Tuple of tensors

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input_x = mindspore.ops.arange(0, 6).reshape((2, 3))
>>> output = mindspore.ops.hsplit(mindspore.tensor(input_x, mindspore.float32), 3)
>>> print(output)
(Tensor(shape=[2, 1], dtype=Float32, value=[[ 0.00000000e+00], [ 3.00000000e+00]]),
 Tensor(shape=[2, 1], dtype=Float32, value=[[ 1.00000000e+00], [ 4.00000000e+00]]),
 Tensor(shape=[2, 1], dtype=Float32, value=[[ 2.00000000e+00], [ 5.00000000e+00]]))