Description: Finds the positions of non-zero elements in [object Object]. Assume that the dimension of [object Object] is D and the number of non-zero elements in [object Object] is N. The shape of [object Object] is D × N. Each column indicates the position coordinates of a non-zero element.
Each operator has calls. First, aclnnNonzeroV2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnNonzeroV2 is called to perform computation.
[object Object][object Object]
Parameters:
- self (aclTensor*, compute input): aclTensor on the device. are supported. The can be ND.
- [object Object]Atlas training series products[object Object] and [object Object]Atlas inference series products[object Object]: The data type can be FLOAT, DOUBLE, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT16, or BOOL.
- [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 FLOAT, DOUBLE, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT16, BOOL, or BFLOAT16.
- out (aclTensor*, compute output): aclTensor on the device. The data type is INT64. are supported. The can be ND.
- workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
- executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
- self (aclTensor*, compute input): aclTensor on the device. are supported. The can be ND.
Returns:
- 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 aclnnNonzeroV2GetWorkspaceSize.
- executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Deterministic compute:
- aclnnNonzeroV2 defaults to a deterministic implementation.
Due to hardware resource restrictions, the output index must be within the int32 range. Therefore, an input dimension cannot exceed the int32 range.
The output size of the API needs to be allocated based on the maximum output size (actually 2 GB when all values are non-zero). In addition, the workspace used by this API is large. Therefore, you need to check whether the workspace exceeds the memory size of the device.
The following example is for reference only. For details, see .