mindspore.ops.unbind
- mindspore.ops.unbind(input, dim=0)[源代码]
移除tensor的指定维度,返回一个沿该维度所有切片的元组。
- 参数:
input (Tensor) - 输入tensor。
dim (int) - 指定维度。默认
0
。
- 返回:
由多个tensor组成的tuple。
- 支持平台:
Ascend
GPU
CPU
样例:
>>> 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]))