- Description: Activation function. The output tensor has the same shape as the input tensor. If the input value is less than –3, the output is 0. If the input value is greater than 3, the output is the value. Otherwise, the output is (value + 3) × value/6.
- Formula:
aclnnHardswish and aclnnInplaceHardswish implement the same function in different ways. Select a proper operator based on your requirements.
- aclnnHardswish: An output tensor object needs to be created to store the computation result.
- aclnnInplaceHardswish: No output tensor object needs to be created, and the computation result is stored in the memory of the input tensor.
Each operator has calls. First, aclnnHardswishGetWorkspaceSize or aclnnInplaceHardswishGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnHardswish or aclnnInplaceHardswish is called to perform computation.
Parameters:
[object Object]- [object Object]Atlas training products[object Object]: The data type can be FLOAT16 or FLOAT32.
Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Parameters:
[object Object]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
- Deterministic computation:
- aclnnHardswish and aclnnInplaceHardswish default to a deterministic implementation.
The following example is for reference only. For details, see .