!37084 Update documnets for scatter_nd_x ops

Merge pull request !37084 from zhujingxuan/code_docs_scatter
This commit is contained in:
i-robot 2022-07-02 03:27:19 +00:00 committed by Gitee
commit 92c039485b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 22 additions and 26 deletions

View File

@ -13,13 +13,10 @@ mindspore.ops.scatter_nd_add
`updates` 表示rank为 `Q-1+P-N` 的Tensorshape为 :math:`(i_0, i_1, ..., i_{Q-2}, x\_shape_N, ..., x\_shape_{P-1})`
输入的 `input_x``updates` 遵循隐式类型转换规则,以确保数据类型一致。
如果数据类型不同则低低精度数据类型将转换为高精度数据类型。当需要参数的数据类型转换时则会抛出RuntimeError异常。
**参数:**
- **input_x** (Parameter) - scatter_nd_add的输入任意维度的Parameter。
- **indices** (Tensor) - 指定加法操作的索引数据类型为mindspore.int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定加法操作的索引数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 相加操作的Tensor数据类型与 `input_x` 相同shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -30,6 +27,6 @@ mindspore.ops.scatter_nd_add
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **RuntimeError** - 当 `input_x``updates` 类型不一致,需要进行类型转换时,如果 `updates` 不支持转成参数 `input_x` 需要的数据类型,就会报错。

View File

@ -16,7 +16,7 @@ mindspore.ops.scatter_nd_div
**参数:**
- **input_x** (Parameter) - 输入参数任意维度的Parameter。
- **indices** (Tensor) - 指定除法操作的索引数据类型为mindspore.int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定除法操作的索引数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 操作的Tensor数据类型与 `input_x` 相同shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -27,6 +27,6 @@ mindspore.ops.scatter_nd_div
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **TypeError** - `input_x``updates` 的数据类型不相同。
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`

View File

@ -16,7 +16,7 @@ mindspore.ops.scatter_nd_max
**参数:**
- **input_x** (Parameter) - 输入参数任意维度的Parameter。
- **indices** (Tensor) - 指定最大值操作的索引数据类型为mindspore.int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定最大值操作的索引数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 操作的Tensor数据类型与 `input_x` 相同shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -27,6 +27,6 @@ mindspore.ops.scatter_nd_max
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **TypeError** - `input_x``updates` 的数据类型不相同。
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`

View File

@ -16,7 +16,7 @@ mindspore.ops.scatter_nd_min
**参数:**
- **input_x** (Parameter) - 输入参数任意维度的Parameter。
- **indices** (Tensor) - 指定最小值操作的索引数据类型为mindspore.int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定最小值操作的索引数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 操作的Tensor数据类型与 `input_x` 相同shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -27,6 +27,6 @@ mindspore.ops.scatter_nd_min
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **TypeError** - `input_x``updates` 的数据类型不相同。
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`

View File

@ -16,7 +16,7 @@ mindspore.ops.scatter_nd_mul
**参数:**
- **input_x** (Parameter) - 输入参数任意维度的Parameter。
- **indices** (Tensor) - 指定乘法操作的索引数据类型为mindspore.int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定乘法操作的索引数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 相乘操作的Tensor数据类型与 `input_x` 相同shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -27,6 +27,6 @@ mindspore.ops.scatter_nd_mul
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **TypeError** - `input_x``updates` 的数据类型不相同。
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`

View File

@ -13,12 +13,10 @@ mindspore.ops.scatter_nd_sub
`updates` 表示rank为 `Q-1+P-N` 的Tensorshape为 :math:`(i_0, i_1, ..., i_{Q-2}, x\_shape_N, ..., x\_shape_{P-1})`
输入的 `input_x``updates` 遵循隐式类型转换规则以确保数据类型一致。如果数据类型不同则低精度数据类型将转换为相高精度数据类型。当需要参数的数据类型转换时则会抛出RuntimeError异常。
**参数:**
- **input_x** (Parameter) - scatter_nd_sub的输入任意维度的Parameter。
- **indices** (Tensor) - 指定减法操作的索引数据类型为int32。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **indices** (Tensor) - 指定减法操作的索引,数据类型为mindspore.int32或mindspore.int64。索引的rank必须至少为2并且 `indices.shape[-1] <= len(shape)`
- **updates** (Tensor) - 指定与 `input_x` 相减操作的Tensor数据类型与输入相同。shape为 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **use_locking** (bool) - 是否启用锁保护。默认值False。
@ -29,6 +27,6 @@ mindspore.ops.scatter_nd_sub
**异常:**
- **TypeError** - `use_locking` 不是bool。
- **TypeError** - `indices` 不是int32。
- **TypeError** - `indices` 的数据类型不是int32或int64
- **ValueError** - `updates` 的shape不等于 `indices.shape[:-1] + x.shape[indices.shape[-1]:]`
- **RuntimeError** - 当 `input_x``updates` 类型不一致,需要进行类型转换时,如果 `updates` 不支持转成参数 `input_x` 需要的数据类型,就会报错。

View File

@ -1577,7 +1577,8 @@ def scatter_nd_add(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32 or an int64.
TypeError: If the dtype of `indices` is not int32 or int64.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
RuntimeError: If the data type of `input_x` and `updates` conversion of Parameter
is required when data type conversion of Parameter is not supported.
@ -1653,7 +1654,7 @@ def scatter_nd_sub(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32 or int64.
TypeError: If the dtype of `indices` is not int32 or int64.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
RuntimeError: If the data type of `input_x` and `updates` conversion of Parameter
is required when data type conversion of Parameter is not supported.
@ -1714,8 +1715,8 @@ def scatter_nd_mul(input_x, indices, updates, use_locking=False):
Args:
input_x (Parameter): The target tensor, with data type of Parameter.
The shape is :math:`(N,*)`, where :math:`*` means any number of additional dimensions.
indices (Tensor): The index to do multiplication operation whose data type must be mindspore.int32.
The rank of indices must be at least 2 and `indices.shape[-1] <= len(shape)`.
indices (Tensor): The index to do multiplication operation whose data type must be mindspore.int32 or
mindspore.int64. The rank of indices must be at least 2 and `indices.shape[-1] <= len(shape)`.
updates (Tensor): The tensor to do the multiplication operation with `input_x`.
The data type is same as `input_x`, and the shape is `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
use_locking (bool): Whether to protect the assignment by a lock. Default: False.
@ -1725,7 +1726,7 @@ def scatter_nd_mul(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32.
TypeError: If the dtype of `indices` is not int32 or int64.
TypeError: If dtype of `input_x` and `updates` are not the same.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
@ -1802,7 +1803,7 @@ def scatter_nd_div(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32 or an int64.
TypeError: If the dtype of `indices` is not int32 or int64.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
RuntimeError: If the data type of `input_x` and `updates` conversion of Parameter
is required when data type conversion of Parameter is not supported.
@ -1864,7 +1865,7 @@ def scatter_nd_max(input_x, indices, updates, use_locking=False):
Args:
input_x (Parameter): The target tensor, with data type of Parameter.
The shape is :math:`(N,*)`, where :math:`*` means any number of additional dimensions.
indices (Tensor): The index to do maximum operation whose data type must be mindspore.int32.
indices (Tensor): The index to do maximum operation whose data type must be mindspore.int32 or mindspore.int64.
The rank of indices must be at least 2 and `indices.shape[-1] <= len(shape)`.
updates (Tensor): The tensor to do the max operation with `input_x`.
The data type is same as `input_x`, and the shape is `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
@ -1875,7 +1876,7 @@ def scatter_nd_max(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32.
TypeError: If the dtype of `indices` is not int32 or int64.
TypeError: If dtype of `input_x` and `updates` are not the same.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
@ -1951,7 +1952,7 @@ def scatter_nd_min(input_x, indices, updates, use_locking=False):
Raises:
TypeError: If `use_locking` is not a bool.
TypeError: If `indices` is not an int32 or an int64.
TypeError: If the dtype of `indices` is not int32 or int64.
ValueError: If the shape of `updates` is not equal to `indices.shape[:-1] + x.shape[indices.shape[-1]:]`.
RuntimeError: If the data type of `input_x` and `updates` conversion of Parameter
is required when data type conversion of Parameter is not supported.