[object Object]

📄

[object Object][object Object]undefined
[object Object]
  • This API is used to fill the values in the src tensor into the self tensor one by one according to the specified axis and the position relationship in the index tensor. If more than one src value is filled into the same position of the self tensor, these values will be accumulated at this position.

    Example: For a 3D tensor, self is updated according to the following rules:

    [object Object]

    The following conditions must be met during computation:

    • self, index, and src must have the same number of dimensions.
    • For each dimension d, index.size(d) <= src.size(d).
    • For each dimension d, if d!= dim, index.size(d) <= self.size(d).
    • The value range of dim is [–self.dim(), self.dim() – 1].
  • Example:

    Input tensor self=[[123][456][789]]self = \begin{bmatrix} [1&2&3] \\ [4&5&6] \\ [7&8&9] \end{bmatrix}, Index tensor index=[[021][001]]index = \begin{bmatrix} [0&2&1] \\ [0&0&1] \end{bmatrix}, dim = 1, Source tensor src=[[101112][131415]]src = \begin{bmatrix} [10&11&12] \\ [13&14&15] \end{bmatrix}, Output tensor output=[[111414][31206][789]]output = \begin{bmatrix} [11&14&14] \\ [31&20&6] \\ [7&8&9] \end{bmatrix}

    dim = 1 indicates that scatter_add accumulates values along the columns of the tensor according to indexindex.

    output[0][0]=self[0][0]+src[0][0]output[0][0] = self[0][0] + src[0][0] = 1 + 10,

    output[0][1]=self[0][1]+src[0][2]output[0][1] = self[0][1] + src[0][2] = 2 + 12,

    output[0][2]=self[0][2]+src[0][1]output[0][2] = self[0][2] + src[0][1] = 3 + 11,

    output[1][0]=self[1][0]+src[1][0]+src[1][1]output[1][0] = self[1][0] + src[1][0] + src[1][1] = 4 + 13 + 14,

    output[1][1]=self[1][1]+src[1][2]output[1][1] = self[1][1] + src[1][2] = 5 + 15,

    output[1][2]=self[1][2]output[1][2] = self[1][2] = 6,

    output[2][0]=self[2][0]output[2][0] = self[2][0] = 7,

    output[2][1]=self[2][1]output[2][1] = self[2][1] = 8,

    output[2][2]=self[2][2]output[2][2] = self[2][2] = 9.

    The number of dimensions of selfself, indexindex, and srcsrc are all 2. The size of each dimension of indexindex {2, 3} is not greater than the corresponding dimension size {2, 3} of srcsrc. On the dimension dim!= 1 (dim = 0), the dimension size {2} of indexindex is not greater than the corresponding dimension size {3} of selfself. The maximum value {2} in indexindex is less than the size {3} of selfself in the dim = 1 dimension.

[object Object]

Each operator has calls. First, aclnnScatterAddGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnScatterAdd is called to perform computation.

[object Object]
[object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter verification. The following errors may be thrown:

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic compute:
    • aclnnScatterAdd defaults to a deterministic implementation.
[object Object]

The following example is for reference only. For details, see .

[object Object]