| Files | Last commit | Last update |
|---|---|---|
| 20 days ago | ||
| 1 month ago | ||
| 1 day ago | ||
| 1 day ago | ||
| 1 day ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 1 day ago | ||
| 1 month ago | ||
| 13 days ago |
ArgMaxWithValue
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
Operator function: returns the maximum values of a tensor along the specified dimension and their index positions. The maximum values are saved to out, and the indices of the maximum values are saved to indices. If keepdim is false, the corresponding axis is not retained; if keepdim is true, the dimension value of the specified axis is retained as 1.
Function Prototype
Each operator is divided into a two-phase API. You must first call the "aclnnMaxDimGetWorkspaceSize" API to obtain the workspace size required for the computation and the executor that contains the operator computation process, and then call the "aclnnMaxDim" API to perform the computation.
aclnnStatus aclnnMaxDimGetWorkspaceSize(const aclTensor *self, int64_t dim, bool keepdim, aclTensor *out, aclTensor *indices, uint64_t *workspaceSize, aclOpExecutor **executor)aclnnStatus aclnnMaxDim(void *workspace, uint64_t workspaceSize, aclOpExecutor *executor, aclrtStream stream)
aclnnMaxDimGetWorkspaceSize
-
Parameter Description:
-
self(aclTensor*, computation input): an aclTensor on the Device side. Supports non-contiguous tensors, and the supported data format is ND. Supports 1 to 8 dimensions.
- Atlas inference products and Atlas training products: The supported data types are FLOAT, FLOAT16, INT64, and BOOL
- Atlas A2 products and Atlas A3 products: The supported data types are FLOAT, FLOAT16, INT64, BOOL, and BFLOAT16
- Ascend 950PR&950DT products: The supported data types are FLOAT, FLOAT16, INT64, BOOL, BFLOAT16, and INT32
-
dim(int64_t, computation input): the specified dimension. The data type is INT64, and the value range is [-self.dim(), self.dim()).
-
keepdim(bool, computation input): specifies whether to retain the dimension of the reduce axis. The data type is BOOL.
-
out(aclTensor*, computation output): an aclTensor on the Device side, and its data type is the same as that of self. Supports non-contiguous tensors, and the supported data format is ND. If keepdim is false, the output dimension is the dimension of self minus 1; if keepdim is true, the output dimension is equal to the dimension of self.
- Atlas inference products and Atlas training products: The supported data types are FLOAT, FLOAT16, INT64, and BOOL
- Atlas A2 products and Atlas A3 products: The supported data types are FLOAT, FLOAT16, INT64, BOOL, and BFLOAT16
- Ascend 950PR&950DT products: The supported data types are FLOAT, FLOAT16, INT64, BOOL, BFLOAT16, and INT32
-
indices(aclTensor*, computation output): an aclTensor on the Device side. Supports non-contiguous tensors, and the supported data format is ND.
- Atlas A2 products, Atlas A3 products, and Ascend 950PR&950DT products: The supported data types are BOOL, FLOAT32, FLOAT16, INT8, INT16, UINT16, UINT8, INT32, INT64, UINT32, UINT64, DOUBLE, COMPLEX64, COMPLEX128, and BFLOAT16.
- Atlas inference products and Atlas training products: The supported data types are BOOL, FLOAT32, FLOAT16, INT8, INT16, UINT16, UINT8, INT32, INT64, UINT32, UINT64, DOUBLE, COMPLEX64, and COMPLEX128.
-
workspaceSize(uint64_t*, output parameter): returns the size of the workspace that needs to be allocated on the Device side.
-
executor(aclOpExecutor**, output parameter): returns the op executor, which contains the operator computation process.
-
-
Return Values:
aclnnStatus: returns a status code. For details, see aclnn Return Codes.
The first-phase API completes input parameter validation and reports an error in the following scenarios:
161001 (ACLNN_ERR_PARAM_NULLPTR): 1. The passed-in self, out, and indices are null pointers.
161002 (ACLNN_ERR_PARAM_INVALID): 1. The data types of self, out, and indices are not within the supported range.
2. The data formats of self, out, and indices are not within the supported range.
3. dim exceeds the dimension range of the input self.
aclnnMaxDim
-
Parameter Description:
-
workspace(void*, input parameter): the memory address of the workspace allocated on the Device side.
-
workspaceSize(uint64_t, input parameter): the size of the workspace allocated on the Device side, obtained by the first-phase API aclnnMaxDimGetWorkspaceSize.
-
executor(aclOpExecutor*, input parameter): the op executor, which contains the operator computation process.
-
stream(aclrtStream, input parameter): specifies the Stream that executes tasks.
-
-
Return Values:
aclnnStatus: returns a status code. For details, see aclnn Return Codes.
Constraint Description
- Deterministic computation:
- aclnnMaxDim uses a deterministic implementation by default.
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_max_dim | Invokes the ArgMaxWithValue operator through the aclnnMaxDim API. |