| Files | Last commit | Last update |
|---|---|---|
| 24 days ago | ||
| 1 month ago | ||
| 4 months ago | ||
| 1 month ago | ||
| 23 days ago | ||
| 3 days ago | ||
| 3 days ago | ||
| 2 months ago | ||
| 3 days ago | ||
| 25 days ago | ||
| 18 days ago |
Scatter
English | 简体中文
Applicable Products
| Product | Support |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function
-
Operator function: Updates the values in tensor
dataone by one with the values in tensorupdatesaccording to the specified axisaxisand indicesindices. -
Example: This operator has three inputs and one attribute:
data,updates,indices, andaxis, wheredatais the tensor to be updated,updatesis the tensor that stores the update data,indicesindicates the update positions, andaxisis the specified update dimension. Based on whetherindicesis 1-dimensional or 2-dimensional, there are the following two scenarios (whenindicesis 0-dimensional, it is equivalent to the 1-dimensional scenario with shape (1), in which case axis 0 ofupdatesmust be 1):Scenario 1:
indicesis 1-dimensional. The i-th element ofindicescorresponds to the i-th batch ofupdates(axis 0 ofupdates) and indicates the starting offset along theaxisdimension when this batch is written into the i-th batch ofdata; the size s ofupdatesalong theaxisdimension is the length written each time, andindices[i] + smust not exceed the size ofdataalong theaxisdimension.Sample input: data:(a, b, c, d) if axis = -2: updates:(n, b, e, d), indices[i] + e <= c if axis = -1: updates:(n, b, c, e), indices[i] + e <= d indices:(n,), n <= adata[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 = -1Scenario 2:
indicesis 2-dimensional, and axis 1 of the shape is 2. The i-th row ofindicescorresponds to the i-th batch ofupdates:indices[i][0]specifies the position along axis 0 ofdatawhere this batch is written (different i can write into different batches ofdata), andindices[i][1]specifies the starting offset along theaxisdimension; the size s ofupdatesalong theaxisdimension is the length written each time, andindices[i][1] + smust not exceed the size ofdataalong theaxisdimension.Sample input: data:(a, b, c, d) if axis = -2: updates:(n, b, e, d), indices[i][1] + e <= c if axis = -1: updates:(n, b, c, e), indices[i][1] + e <= d indices:(n, 2), indices[i][0] < adata[indices[i][0]][j][indices[i][1]+k][l] = updates[i][j][k][l] # if dim = -2 data[indices[i][0]][j][k][indices[i][1]+l] = updates[i][j][k][l] # if dim = -1
Constraints
- Axis 0 of the shape of
updatesis consistent with axis 0 of the shape ofindices. - When
indicesis 0-dimensional, axis 0 of the shape ofupdatesis 1. - Axis 0 of the shape of
updatesis less than or equal to axis 0 of the shape ofdata. - Except for the
axisdimension and axis 0, all other dimensions of the shapes ofupdatesanddataare the same. - When the shape of
indicesis two-dimensional, axis 1 of the shape must equal 2. - When the data type of
indicesis INT32, DtypeSize=4; when it is INT64, DtypeSize=8. IndicesShapeSize is the product of the shape ofindices, and the ub to be used = IndicesShapeSize * DtypeSize + 224. When the ub is greater than the total ub size available on the corresponding AI processor version, this is not supported. - When
indicescontains duplicates, the results at the duplicated positions are not guaranteed. - Deterministic computation: when
indicescontains duplicate values, the results are non-deterministic. If deterministic computation is enabled, the determinism of the results is guaranteed (only the Ascend 950PR&950DT products need to explicitly enable it, and the other supported models are deterministic by default).
Invocation Description
| Invocation method | Sample code | Description |
|---|---|---|
| aclnn interface | test_aclnn_inplace_scatter_update | Invokes the Scatter operator through the aclnnInplaceScatterUpdate interface. |