Description: Extracts elements from the specified dimension dim of the input tensor based on the index number in index. batchDims indicates the batch size. The result is saved to the out tensor.
Example:
For example, when batchDims is 0, the input tensor self = \begin{bmatrix}1 & 2 & 3 \ 4 & 5 & 6 \ 7 & 8 & 9\end{bmatrix}$ and the index tensor index = [1, 0].
Result of dim = 0:
Result of dim = 1:
The computation process is as follows: Take a 3D tensor with shape (3, 2, 2) as an example: Assume self = with index = [1, 0], the indices corresponding to dim 0, 1, and 2 are , , and , respectively. index is 1D (if it is 0D, it is considered as a 1D tensor with the size of 1).
dim = 0: I = index[i]; out = self
dim = 1: J = index[j]; out = self
dim = 2: K = index[k]; out = self
When batchDims is 1, take a 4D tensor as an example. The tensor self with shape (3, 3, 2, 2) and the tensor index with shape (3, 2) can be obtained from performing the gather operation three times with batchDims being 0 and dim being dim – batchDims.
Each operator has calls. First, aclnnGatherV3GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnGatherV3 is called to perform computation.
Parameters
[object Object]- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: Currently, dim supports only 0 and batchDims supports only 0.
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 computation:
- aclnnGatherV3 defaults to a deterministic implementation.
The following example is for reference only. For details, see .