- Description: Activation function, which is used to solve the problem that the output of the Relu function is 0 when the input is less than 0 to prevent neurons from failing to update parameters.
- Formula:
aclnnLeakyRelu and aclnnInplaceLeakyRelu implement the same function in different ways. Select a proper operator based on your requirements.
- aclnnLeakyRelu: An output tensor object needs to be created to store the computation result.
- aclnnInplaceLeakyRelu: 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, aclnnLeakyReluGetWorkspaceSize or aclnnInplaceLeakyReluGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnLeakyRelu or aclnnInplaceLeakyRelu is called to perform computation.
Parameters:
[object Object]- [object Object]Atlas training products[object Object]: FLOAT and FLOAT16.
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]- [object Object]Atlas training products[object Object]: The data type can be FLOAT, FLOAT16, or DOUBLE.
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 compute:
- aclnnLeakyRelu&aclnnInplaceLeakyRelu defaults to a deterministic implementation.
If negativeSlope is an integer and self is of the FLOAT type, precision loss may occur when negativeSlope is greater than 2^24 or less than -2^24. Similarly, if self is of the FLOAT16 type, precision loss may occur when negativeSlope is greater than 2^11 or less than -2^11.
The following example is for reference only. For details, see .
aclnnLeakyRelu sample code:
aclnnInplaceLeakyRelu sample code: