文档反馈

问题文档片段

问题文档片段包含公式时,显示为空格。

提交类型
issue

有点复杂...

找人问问吧。

请选择提交类型

问题类型
规范和低错类

- 规范和低错类:

- 错别字或拼写错误,标点符号使用错误、公式错误或显示异常。

- 链接错误、空单元格、格式错误。

- 英文中包含中文字符。

- 界面和描述不一致,但不影响操作。

- 表述不通顺,但不影响理解。

- 版本号不匹配:如软件包名称、界面版本号。

易用性

- 易用性:

- 关键步骤错误或缺失,无法指导用户完成任务。

- 缺少主要功能描述、关键词解释、必要前提条件、注意事项等。

- 描述内容存在歧义指代不明、上下文矛盾。

- 逻辑不清晰,该分类、分项、分步骤的没有给出。

正确性

- 正确性:

- 技术原理、功能、支持平台、参数类型、异常报错等描述和软件实现不一致。

- 原理图、架构图等存在错误。

- 命令、命令参数等错误。

- 代码片段错误。

- 命令无法完成对应功能。

- 界面错误,无法指导操作。

- 代码样例运行报错、运行结果不符。

风险提示

- 风险提示:

- 对重要数据或系统存在风险的操作,缺少安全提示。

内容合规

- 内容合规:

- 违反法律法规,涉及政治、领土主权等敏感词。

- 内容侵权。

请选择问题类型

问题描述

点击输入详细问题描述,以帮助我们快速定位问题。

mindspore.ops.SplitV

class mindspore.ops.SplitV(size_splits, split_dim, num_split)[源代码]

Splits the input tensor into num_split tensors along the given dimension.

The input_x tensor will be split into sub-tensors with individual shapes given by size_splits along the split dimension. This requires that input_x.shape(split_dim) is equal to the sum of size_splits.

The shape of input_x is (x1,x2,...,xM,...,xR). The rank of input_x is R. Set the given split_dim as M, and RM<R. Set the given num_split as N, the given size_splits as (xm1,xm2,...,xmN), xM=i=1Nxmi. The output is a list of tensor objects, for the i-th tensor, it has the shape of (x1,x2,...,xmi,...,xR). xmi is the M-th dimension of the i-th tensor. Then, the shape of the output tensor is

((x1,x2,...,xm1,...,xR),(x1,x2,...,xm2,...,xR),...,(x1,x2,...,xmN,...,xR))
Parameters
  • size_splits (Union[tuple, list]) – The list containing the sizes of each output tensor along the split dimension. Must sum to the dimension of value along split_dim. Can contain one -1 indicating that dimension is to be inferred.

  • split_dim (int) – The dimension along which to split. Must be in the range [-len(input_x.shape), len(input_x.shape)).

  • num_split (int) – The number of output tensors. Must be positive int.

Inputs:
  • input_x (Tensor) - The shape of tensor is (x1,x2,...,xM...,xR).

Outputs:

Tensor, a list of num_split Tensor objects with the shape ((x1,x2,...,xm1,...,xR),(x1,x2,...,xm2,...,xR),...,(x1,x2,...,xmN,...,xR)), xM=i=1Nxmi. The data type is the same with input_x.

Raises
  • TypeError – If input_x is not a Tensor.

  • TypeError – If size_splits is not a tuple or a list.

  • TypeError – If element of size_splits is not an int.

  • TypeError – If split_dim or num_split is not an int.

  • ValueError – If rank of the size_splits is not equal to num_split.

  • ValueError – If sum of the size_splits is not equal to the dimension of value along split_dim.

  • ValueError – If split_dim is out of the range [-len(input_x.shape), len(input_x.shape)).

  • ValueError – If the num_split is less than or equal to 0.

Supported Platforms:

Ascend

Examples

>>> input_x = Tensor(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), mindspore.int32)
>>> op = ops.SplitV(size_splits=[1, -1], split_dim=1, num_split=2)
>>> output = op(input_x)
>>> print(output)
(Tensor(shape=[3, 1], dtype=Int32, value=
[[1],
 [4],
 [7]]), Tensor(shape=[3, 2], dtype=Int32, value=
[[2, 3],
 [5, 6],
 [8, 9]]))
>>> input_x = Tensor(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), mindspore.int32)
>>> op = ops.SplitV(size_splits=[2, 1], split_dim=0, num_split=2)
>>> output = op(input_x)
>>> print(output)
(Tensor(shape=[2, 3], dtype=Int32, value=
[[1, 2, 3],
 [4, 5, 6]]), Tensor(shape=[1, 3], dtype=Int32, value=
[[7, 8, 9]]))