mindspore.ops.unbind

View Source On Gitee
mindspore.ops.unbind(input, dim=0)[source]

Remove a tensor dimension, return a tuple of all slices along a given dimension.

Parameters
  • input (Tensor) – The input tensor.

  • dim (int) – Specipy the dimension to remove. Default 0 .

Returns

tuple of tensors.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> x = mindspore.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> output = mindspore.ops.unbind(x, dim=0)
>>> print(output)
(Tensor(shape=[3], dtype=Int64, value=[1, 2, 3]), Tensor(shape=[3], dtype=Int64, value=[4, 5, 6]),
Tensor(shape=[3], dtype=Int64, value=[7, 8, 9]))