mindspore/docs/api/api_python/ops/mindspore.ops.func_scatter.rst

23 lines
1.3 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.scatter
=======================================
.. py:function:: mindspore.ops.scatter(x, axis, index, src)
根据指定索引将 `src` 中的值更新到 `x` 中返回输出。
有关更多详细信息,请参阅 :func:`mindspore.ops.tensor_scatter_elements`
参数:
- **x** (Tensor) - 输入Tensor。 `x` 的秩必须至少为1。
- **axis** (int) - 要进行更新操作的轴。取值范围是[-r, r)其中r是 `x` 的秩。
- **index** (Tensor) - 输入Tensor的索引数据类型为int32或int64的。其rank必须和 `x` 一致。取值范围是[-s, s)这里的s是 `x``axis` 指定轴的size。
- **src** (Tensor) - 指定与 `x` 进行更新操作的Tensor其数据类型与输入 `x` 的数据类型相同。 `src` 的shape必须等于 `index` 的shape。
返回:
Tensorshape和数据类型与输入 `x` 相同。
异常:
- **TypeError** - `index` 的数据类型既不是int32也不是int64。
- **ValueError** - `x``index``src`任意一者的秩小于1。
- **ValueError** - `src` 的shape和 `index` 的shape不一样。
- **ValueError** - `src` 的秩和 `x` 的秩不一样。
- **RuntimeError** - `x` 的数据类型和 `src` 的数据类型不能隐式转换。