[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Replaces, accumulates, or multiplies the values in the tensor src to the tensor self based on the given axis and direction and the corresponding position relationship.

  • Example: For a three-dimensional tensor, self is updated based on 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, there is a restriction that index.size(d) <= src.size(d).
    • For each dimension d, if d != dim, there is a restriction that index.size(d) <= self.size(d).
    • The value of dim must be within the range of [–(number of dimensions of self), (number of dimensions of self) – 1].
    • The number of dimensions of self must be less than or equal to eight.
    • The corresponding dim value in index must be within the range of [0, self.size(dim) – 1].
[object Object]
  • aclnnScatter and aclnnInplaceScatter implement the same function in different ways. Select a proper operator based on your requirements.

    • aclnnScatter: An output tensor object needs to be created to store the computation result.
    • aclnnInplaceScatter: No output tensor object needs to be created, and the computation result is stored in the memory of the input tensor.
  • Each operator has calls. First, aclnnScatterGetWorkspaceSize or aclnnInplaceScatterGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnScatter or aclnnInplaceScatter is called to perform computation.

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

    • self (aclTensor*, compute input): [object Object] in the formula, aclTensor on the device. The number of dimensions of self must be the same as those of index and src. The shape supports zero to eight dimensions. The data type of self must be the same as that of src. are supported. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, or COMPLEX128.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, COMPLEX128, or BFLOAT16.
    • dim (int64_t, compute input): dimension used for scattering. The data type can be INT64. The value range is [–(number of dimensions of self), (number of dimensions of self) – 1].

    • index (aclTensor*, compute input): [object Object] in the formula, aclTensor on the device. It indicates the index tensor. The data type can be INT32 or INT64. The number of dimensions of index must be the same as those of self and src. The shape supports zero to eight dimensions. are supported. The can be ND.

    • src (aclTensor*, compute input): [object Object] in the formula, aclTensor on the device. The number of dimensions of src must be the same as those of self and index. The shape supports zero to eight dimensions. The data type of src must be the same as that of self. are supported. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, or COMPLEX128.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, COMPLEX128, or BFLOAT16.
    • reduce (int64_t, compute input): integer on the host, used to select a reduction to apply. The options and corresponding integer values are add (1), mul (2), and none (0). The specific operations are defined as follows: 0: replaces the value at a position in src to the corresponding position in out according to index. 1: accumulates the value at a position in src to the corresponding position in out according to index. 2: multiplies the value at a position in src to the corresponding position in out according to index.

    • out (aclTensor*, compute output): The data type is the same as that of self. The shape must be the same as that of self. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, or COMPLEX128.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, COMPLEX128, or BFLOAT16.
    • workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.

    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.

  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.

    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnScatterGetWorkspaceSize.

    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.

    • stream (aclrtStream, input): stream for executing the task.

  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Parameters:

    • selfRef (aclTensor*, compute input | compute output): target tensor of scatter, [object Object] in the formula, aclTensor on the device. The shape supports zero to eight dimensions, and the number of dimensions of the shape must be the same as those of index and src. The data type is the same as that of src. Empty tensors and are supported. The can be ND.
      • [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, or COMPLEX128.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT32, DOUBLE, COMPLEX64, COMPLEX128, or BFLOAT16.
    • dim (int64_t, compute input): dimension along which the scattering operation is performed. The data type is INT64. It is an integer on the host. The value range is [–(number of dimensions of selfRef), (number of dimensions of selfRef) – 1].
    • index (aclTensor*, compute input): index tensor, specifying the indexes of the src tensor distributed to the self tensor, aclTensor on the device. The data type can be INT32 or INT64. The number of dimensions of index must be the same as those of selfRef and src. The shape supports zero to eight dimensions. For each dimension d, make sure index.size(d) <= src.size(d). If d!= dim, make sure index.size(d) <= selfRef.size(d). Empty tensors and are supported. The can be ND.
    • src (aclTensor*, compute input): <idp:inline displayname="code" id="code56285812499">src[object Object] in the formula, aclTensor on the device. It is a source tensor. Its values are distributed to self based on the position specified by the index tensor. src must have the same number of dimensions as selfRef and index, and the shape supports zero to eight dimensions. The data type of src must be the same as that of selfRef. Empty tensors and are supported. The can be ND.
      • [object Object]Atlas training series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT, DOUBLE, COMPLEX64, or COMPLEX128.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be UINT8, INT8, INT16, INT32, INT64, BOOL, FLOAT16, FLOAT, DOUBLE, COMPLEX64, COMPLEX128, or BFLOAT16.
    • reduce (int64_t, compute input): used to select a reduction to apply. The options and corresponding integer values are add (1), mul (2), and none (0). The specific operations are defined as follows: 0: replaces the value at a position in src to the corresponding position in selfRef according to index. 1: accumulates the value at a position in src to the corresponding position in selfRef according to index. 2: multiplies the value at a position in src to the corresponding position in selfRef according to index.
    • workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
  • Returns

    aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.
    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnInplaceScatterGetWorkspaceSize.
    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic compute:
    • aclnnScatter&aclnnInplaceScatter defaults to a deterministic implementation.
[object Object]

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

aclnnScatter sample code:

[object Object]

aclnnInplaceScatter sample code:

[object Object]