[object Object]

[object Object][object Object]undefined
[object Object]

Description: Removes duplicate elements from the input tensor self and returns the unique elements in self. This is an enhanced unique function, with a new return value countsOut indicating the number of occurrences for where elements in the input self map to in valueOut, controlled by the returnCounts parameter.

[object Object]

Each operator has calls. First, aclnnUnique2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUnique2 is called to perform computation.

  • [object Object]
  • [object Object]
[object Object]
  • Parameters:

    • self (aclTensor*, compute input): target tensor to be unique, aclTensor on the device. The shape can be one- to eight-dimensional. and empty tensors are supported. The can be ND.
      • [object Object]Atlas training series products[object Object]: The data type can be BOOL, FLOAT, FLOAT16, DOUBLE, UINT8, INT8, UINT16, INT16, INT32, UINT32, UINT64, or INT64.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be BOOL, FLOAT, FLOAT16, DOUBLE, UINT8, INT8, UINT16, INT16, INT32, UINT32, UINT64, INT64, or BFLOAT16.
    • sorted (bool, compute input): whether to sort valueOut in ascending order.
    • returnInverse (bool, compute input): whether to return the indexes of each input element in valueOut.
    • returnCounts (bool, compute input): whether to return the number of unique elements in valueOut in the original input tensor.
    • valueOut (aclTensor*, compute output): first output tensor, which stores the unique elements in the input tensor. It is an aclTensor on the device. The shape can only be one-dimensional. The number of elements is the same as that of self. are supported. The can be ND.
      • [object Object]Atlas training series products[object Object]: The data type can be BOOL, FLOAT, FLOAT16, DOUBLE, UINT8, INT8, UINT16, INT16, INT32, UINT32, UINT64, or INT64.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be BOOL, FLOAT, FLOAT16, DOUBLE, UINT8, INT8, UINT16, INT16, INT32, UINT32, UINT64, INT64, or BFLOAT16.
    • inverseOut (aclTensor*, compute output): second output tensor, which is valid when returnInverse is True or returnCounts is True. It returns the position subscript of each self element in valueOut. It is an aclTensor on the device. The shape is the same as that of self. The data type can be INT64. The can be ND. are supported.
    • countsOut (aclTensor*, compute output): third output tensor, which is valid when returnCounts is True. It returns the number of occurrences of each valueOut element in self. It is an aclTensor on the device. The shape is the same as that of valueOut. The data type can be INT64. The can be ND. are supported.
    • workspaceSize (uint64_t*, output): size of the workspace required to be allocated on the device.
    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
  • Returns: aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.
    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnUnique2GetWorkspaceSize.
    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic compute:

    • aclnnUnique2 defaults to a deterministic implementation.

    *[object Object]Atlas training series products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: If the input self contains 0, the output of the operator may contain positive 0s and negative 0s, instead of only one 0.

[object Object]

The following example is for reference only. For details, see .

[object Object]