Description: Gathers data of a specific dimension dim in the input tensor.
Formula: Assume that indicates a tensor, indicates a dimension, and indicates an index tensor. If is defined as the dimension of , is the index of , and indicates the th index value of tensor in dimension . To gather data of the specific dimension d, use the following formula:
Example:
Example 1: Assume that the input tensor self = and the index tensor index = with dim = 0. Then, the output tensor out = . The calculation process is as follows:
Example 2: Assume that the input tensor self = and the index tensor index = with dim = 1. Then, the output tensor out = . The calculation process is as follows:
Each operator has calls. First, aclnnGatherGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnGather 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]
- Deterministic computation:
- aclnnGather defaults to a deterministic implementation.
The following example is for reference only. For details, see .