mindspore.ops.unstack

查看源文件
mindspore.ops.unstack(input_x, axis=0)[源代码]

按指定轴对输入tensor进行拆分。

参数:
  • input_x (Tensor) - 输入tensor。

  • axis (int) - 指定轴。默认 0

返回:

多个tensor组成的tuple。

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> input = mindspore.tensor([[1, 1, 1, 1], [2, 2, 2, 2]])
>>> mindspore.ops.unstack(input, 0)
(Tensor(shape=[4], dtype=Int64, value= [1, 1, 1, 1]),
 Tensor(shape=[4], dtype=Int64, value= [2, 2, 2, 2]))