Function: Replaces, accumulates, or multiplies the values in the tensor src to the tensor self element by element based on the specified axis, direction, and position relationship.
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, there is a restriction that index.size(d) <= src.size(d).
- For each dimension d, if d!= dim, index.size(d) <= self.size(d) must be met.
- 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].
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.
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]
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]
- Deterministic compute:
- aclnnScatter&aclnnInplaceScatter defaults to a deterministic implementation.
The following example is for reference only. For details, see .
aclnnScatter sample code:
aclnnInplaceScatter sample code: