FilesLast commitLast update
20 days ago
2 months ago
27 days ago
21 days ago
21 days ago
10 days ago
8 months ago
22 days ago
10 days ago
1 month ago
12 days ago
README

ArgMaxV2

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

Returns the indices of the maximum values of a tensor along the specified dimension (dim) and saves them to the out tensor.

Function Prototype

Each operator is divided into a two-phase API. You must first call the "aclnnArgMaxGetWorkspaceSize" API to obtain the workspace size required for the computation and the executor that contains the operator computation process, and then call the "aclnnArgMax" API to perform the computation.

aclnnStatus aclnnArgMaxGetWorkspaceSize(
  const aclTensor *self,
  int64_t          dim,
  bool             keepdim,
  aclTensor       *out,
  uint64_t        *workspaceSize,
  aclOpExecutor  **executor)
aclnnStatus aclnnArgMax(
  void          *workspace,
  uint64_t       workspaceSize,
  aclOpExecutor *executor,
  aclrtStream    stream)

aclnnArgMaxGetWorkspaceSize

  • Parameter Description:

    Parameter Name Input/Output Description Usage Instructions Data Type Data Format Dimension (shape) Non-contiguous Tensor
    self Input Input tensor. - FLOAT, FLOAT16, BFLOAT16, DOUBLE, INT8, INT16, INT32, INT64, UINT8, UINT16 ND - √
    dim Input Specifies the dimension on which the maximum value is computed. The value range is [-self.dim(), self.dim()). - - - -
    keepdim Input Specifies whether to retain the dimensions of the input tensor in the output tensor. - - - - -
    out Output Input tensor. - INT32, INT64 ND - √
    workspaceSize Output Returns the size of the workspace that needs to be allocated on the Device side. - - - - -
    executor Output Returns the op executor, which contains the operator computation process. - - - - -
    • Atlas inference products and Atlas training products: The data types BFLOAT16 and UINT16 are not supported.
    • Atlas A2 products and Atlas A3 products: The data type UINT16 is not supported.
  • 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:

    Return Code Error Code Description
    ACLNN_ERR_PARAM_NULLPTR 161001 The passed-in self or out is a null pointer.
    ACLNN_ERR_PARAM_INVALID 161002 The data types of self and out are not within the supported range.
    The shape of self exceeds 8 dimensions.
    dim is not within the valid range.

aclnnArgMax

  • Parameter Description:

    Parameter Name Input/Output Description
    workspace Input The memory address of the workspace allocated on the Device side.
    workspaceSize Input The size of the workspace allocated on the Device side, obtained by the first-phase API aclnnArgMaxGetWorkspaceSize.
    executor Input The op executor, which contains the operator computation process.
    stream Input Specifies the Stream that executes tasks.
  • Return Values:

    aclnnStatus: returns a status code. For details, see aclnn Return Codes.

Constraint Description

  • Deterministic computation:
    • aclnnArgMax uses a deterministic implementation by default.

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_arg_max_v2 Invokes the ArgMaxV2 operator through the aclnnArgMax API.