Description: Returns the matrix norm or vector norm of a given tensor.
Formula: Supports the 1/2 norm, infinity norm, and other norms whose
[object Object]is of the float type.1-norm:
2-norm (default value):
Infinity norm:
p-norm:
Each operator has calls. First, aclnnNormGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnNorm is called to perform computation.
[object Object][object Object]
Parameters:
self (aclTensor*, input):
[object Object]in the formula, aclTensor on the device. The shape supports zero to eight dimensions. are supported. The can be ND.- [object Object]Atlas training series products[object Object], [object Object]Atlas inference series products[object Object], and [object Object]Atlas 200I/500 A2 inference products[object Object]: The data type can be FLOAT or FLOAT16.
- [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, FLOAT16, or BFLOAT16.
pScalar (aclScalar*, compute input): norm type,
[object Object]in the formula. The 0-norm, 1-norm, 2-norm, 3-norm, and infinity norm are supported. The data type can be FLOAT.dim (aclIntArray*, compute input): dimension of the self norm. The value range is [–N, N – 1]. The elements in dims must be unique. N indicates the dimension of self and can be a negative number. The data type can be INT.
keepdim (bool, compute input): whether to retain the dimension specified by dim of the input tensor in the output tensor, bool constant on the host.
relType (aclDataType, compute input): This parameter is reserved and cannot be used yet.
out (aclTensor*, compute output): aclTensor on the device. The shape supports zero to eight dimensions. If keepDims is true, the shape must be the same as that of self except the dimension dim is of size 1. If keepDims is false, the shape must be the same as that of self except the reduced axis. are supported. The can be ND.
- [object Object]Atlas training series products[object Object], [object Object]Atlas inference series products[object Object], and [object Object]Atlas 200I/500 A2 inference products[object Object]: The data type can be FLOAT or FLOAT16.
- [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, FLOAT16, or BFLOAT16.
workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
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 aclnnNormGetWorkspaceSize.
executor (aclOpExecutor*, output): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic compute
- aclnnNorm defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
The following example is for reference only. For details, see .