- Description: Performs an activation function. Returns a tensor with the same shape as the input tensor. If the value in the tensor is greater than or equal to 0, the value is used. If the value is less than 0, 0 is used.
- Formula:
aclnnRelu and aclnnInplaceRelu implement the same function in different ways. Select a proper operator based on your requirements.
- aclnnRelu: An output tensor object needs to be created to store the computation result.
- aclnnInplaceRelu: 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, aclnnReluGetWorkspaceSize or aclnnInplaceReluGetWorkspaceSize is called to obtain input parameters and compute the required workspace size based on the computation process. Then, aclnnRelu or aclnnInplaceRelu is called to perform computation.
Parameters:
[object Object]- For the [object Object]Atlas training products[object Object], the supported data types are FLOAT, FLOAT16, INT8, INT32, and INT64.
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, INT8, INT32, INT64, or UINT8.
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:
- aclnnRelu and aclnnInplaceRelu default to a deterministic implementation.
The following example is for reference only. For details, see .
Example of calling aclnnRelu:
Example of calling the aclnnInplaceRelu API: