---
title: ScatterElementsV2Operation
description: "| 硬件型号 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_01_0255.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_01_0255.html
indexId: c9cb7f56fcbdb6bf4bfcfa6604f185a45879b054cbd5695584f65356ac7473c964
---
# ScatterElementsV2Operation

#### 产品支持情况

| 硬件型号 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 推理系列产品 / Atlas A3 训练系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | x |
| Atlas 推理系列产品 | x |
| Atlas 200I/500 A2 推理产品 | x |


#### 功能说明

将张量update中的所有的值，按照indices位置，写到自身张量input中。


#### 定义

```
struct ScatterElementsV2Param {
    enum ReductionType {
        NONE = 0,
        ADD, 
    };
    int32_t axis = -1;
    ReductionType reduction = NONE;
    uint8_t rsv[24] = {0};
};
```


#### 参数列表

| 成员名称 | 类型 | 默认值 | 取值范围 | 是否必选 | 描述 |
| --- | --- | --- | --- | --- | --- |
| axis | int32\_t | \-1 | \-1 | 否 | 按照指定轴进行更新或者累加，目前只支持取值为 \-1。 |
| reduction | int32\_t | 0 | 0,1 | 否 | 指定是原地更新还是原地累加。 0：原地更新。 1：原地累加。 |
| rsv[24] | [uint8\_t] | {0} | [0] | 否 | 预留参数。 |


#### 输入

| 参数 | 维度 | 数据类型 | 格式 | 描述 |
| --- | --- | --- | --- | --- |
| input | [x\_0，x\_1,...,x\_n] | float16/float/uint8/int8/int32/bfloat16 | ND | 原始输入张量，最终结果原地写入此张量。 |
| indice | [y\_0，y\_1,...,y\_n] | int64/int32 | ND | 索引。在非尾轴和非0轴上的shape必须和input一致 。 0轴和尾轴不大于input的0轴和尾轴。 indice与input中对应维度dim的值的取值范围必须在[0, input中对应维度dim\-1]之间。例如：input shape是[3,3,3]，那indice中的值的取值范围是[0,2]。 |
| update | [y\_0，y\_1,...,y\_n] | 同input | ND | 待更新或累加到原始输入张量中的张量。 |


#### 输出

| 参数 | 维度 | 数据类型 | 格式 | 描述 |
| --- | --- | --- | --- | --- |
| input | [dim\_0, dim\_1,...,dim\_n] | float16/float/uint8/int8/int32/bfloat16 | ND | 原始输入张量，最终结果原地写入此张量。 |
