- Description: Computes the vector norm of the input tensor.
- Formula: n indicates the size of the dimensions specified by dims.
Each operator has calls. First, aclnnLinalgVectorNormGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnLinalgVectorNorm is called to perform computation.
[object Object][object Object]
Parameters:
self (aclTensor*, compute input):
[object Object]in the formula, aclTensor on the device. The shape supports 0 to 8 dimensions. are supported, and the supports ND.- [object Object]Atlas training 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.
ord (aclScalar*, compute input): norm type,
[object Object]in the formula, and aclScalar on the device.- [object Object]Atlas 200I/500 A2 inference products[object Object], [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]: The value can be 0.0, 1.0, 2.0, or 3.0. The data type can be FLOAT.
dims (aclIntArray*, compute input): dimension for computing the norm, aclIntArray on the device. The value range is [-N, N-1]. The elements in dims must be unique. N indicates the dimension of self. The default value is None, in which case self is flattened and then calculated. The data type can be INT64.
keepDims (bool, compute input): whether to retain the axis specified by dims in the output tensor. It is a bool constant on the host.
dtype (aclDataType, compute input): data type for self computation, aclDataType constant on the host. The data type must be the same as that of out. Before computation, convert self to the specified data type. The data types of dtype and self must meet the conversion relationship: When the data type of self is FLOAT, dtype can only be FLOAT. When the data type of self is FLOAT16, dtype can be FLOAT or FLOAT16. When the data type of self is BFLOAT16, dtype can be FLOAT or BFLOAT16.
- [object Object]Atlas training 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.
out (aclTensor*, compute output):
[object Object]in the formula, aclTensor on the device. The shape supports 0 to 8 dimensions. If keepDims is true, the shape of dimensions must be the same as that of self except that the size of the dimension specified by dim is 1. If keepDims is false, the dimension of the reduce axis is not reserved, and the shape of other dimensions must be the same as that of self. are supported, and the supports ND.- [object Object]Atlas training 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 aclnnLinalgVectorNormGetWorkspaceSize.
executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
- Deterministic compute
- aclnnLinalgVectorNorm defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
The following example is for reference only. For details, see .