mindspore.ops.vsplit
- mindspore.ops.vsplit(input, indices_or_sections)[源代码]
根据 indices_or_sections 将输入Tensor input 垂直分割成多个子Tensor。等同于 \(axis=0\) 时的 ops.tensor_split 。
- 参数:
input (Tensor) - 待分割的Tensor。
indices_or_sections (Union[int, tuple(int), list(int)]) - 参考
mindspore.ops.tensor_split()
。
- 返回:
tuple[Tensor]。
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import numpy as np >>> from mindspore import Tensor, ops >>> input_x = np.arange(9).reshape((3, 3)).astype('float32') >>> output = ops.vsplit(Tensor(input_x), 3) >>> print(output) (Tensor(shape=[1, 3], dtype=Float32, value=[[ 0.00000000e+00, 1.00000000e+00, 2.00000000e+00]]), Tensor(shape=[1, 3], dtype=Float32, value=[[ 3.00000000e+00, 4.00000000e+00, 5.00000000e+00]]), Tensor(shape=[1, 3], dtype=Float32, value=[[ 6.00000000e+00, 7.00000000e+00, 8.00000000e+00]]))