Scatter
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | × |
| Atlas 训练系列产品 | √ |
功能说明
-
算子功能: 将tensor updates中的值按指定的轴axis和索引indices逐个更新tensor data中的值。
-
示例: 该算子有3个输入和一个属性:data,updates,indices和axis,其中data是待更新的tensor,updates是存储更新数据的tensor,indices表示更新位置, axis是指定的更新维度。当indices为1维,存在以下两种场景:
场景一: indices为1维,axis指定更新的维度shape为1,indices指定的是每个batch维度(最高维)在axis维度的偏移。
样例输入: data:(a, b, c, d) updates:(a, b, 1, d) indices:(a,) axis = -2data[i][j][indices[i]][k] = updates[i][j][0][k] # if dim=-2 data[i][j][k][indices[i]] = updates[i][j][k][0] # if dim=-1场景二: indices为1维,axis指定更新的维度shape大于1,indices指定的是每个batch维度(最高维)在axis维度的偏移。
样例输入: data:(a, b, c, d) updates:(a, b, e, d), indices[i] + e <= c indices:(a,) axis = -2 or 2data[i][j][indices[i]+k][l] = updates[i][j][k][l] # if dim=-2 data[i][j][k][indices[i]+l] = updates[i][j][k][l] # if dim=-1
约束说明
无
调用说明
| 调用方式 | 样例代码 | 说明 |
|---|---|---|
| aclnn接口 | test_aclnn_scatter | 通过aclnnInplaceScatterUpdate接口方式调用Scatter算子。 |