Description: Computes the SmoothL1 loss function.
Formula:
If
[object Object]is[object Object], the loss function for batch N is defined as follows:is calculated as follows:
If
[object Object]is[object Object]or[object Object]:
Each operator has calls. First, aclnnSmoothL1LossGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnSmoothL1Loss 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 must meet the with that of target. The shape supports a maximum of eight dimensions. The data type must meet the . are supported. The can be ND, NCL, NCHW, or NHWC.- [object Object]Atlas training series products[object Object]: The data type can be FLOAT16 or FLOAT32.
- [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 BFLOAT16, FLOAT16, or FLOAT32.
target (aclTensor*, compute input):
[object Object]in the formula, aclTensor on the device. The shape must meet the with that of self. The shape supports a maximum of eight dimensions. The data type must meet the . are supported. The can be ND, NCL, NCHW, or NHWC.- [object Object]Atlas training series products[object Object]: The data type can be FLOAT16 or FLOAT32.
- [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 BFLOAT16, FLOAT16, or FLOAT32.
reduction (int64_t, compute input): input to be applied to the reduction formula of the output,
[object Object]in the formula, an integer on the host. The value can be 0 ('none') | 1 ('mean') | 2 ('sum'). none indicates that no reduction is applied; mean indicates that the sum of the output will be divided by the number of elements in the output; sum indicates that the output will be summed.beta (float, compute input): The data type can be FLOAT. The value must be non-negative.
result (aclTensor*, compute output): loss function output in the formula. When
[object Object]is[object Object], the shape is the same as the broadcast result of self and target. When[object Object]is[object Object]or[object Object], the shape is [ ]. are supported. The can be ND, NCL, NCHW, or NHWC.- [object Object]Atlas training series products[object Object]: The data type can be FLOAT16 or FLOAT32.
- [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 BFLOAT16, FLOAT16, or FLOAT32.
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 aclnnSmoothL1LossGetWorkspaceSize.
executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic compute:
- aclnnSmoothL1Loss defaults to a deterministic implementation.
The following example is for reference only. For details, see .