24.02.1
|
#include "arm_compute/AclOperators.h"
#include "src/common/IOperator.h"
#include "src/common/utils/Macros.h"
#include "src/common/utils/Validate.h"
Go to the source code of this file.
Functions | |
AclStatus | AclActivation (AclOperator *external_op, AclContext external_ctx, const AclTensorDescriptor *src, const AclTensorDescriptor *dst, const AclActivationDescriptor info) |
__cplusplus More... | |
AclStatus AclActivation | ( | AclOperator * | op, |
AclContext | ctx, | ||
const AclTensorDescriptor * | src, | ||
const AclTensorDescriptor * | dst, | ||
const AclActivationDescriptor | info | ||
) |
__cplusplus
Create an activation operator
Applies an activation function to a given tensor . Compute Library supports a wide list of activation functions AclActivationType.
A summarized table is the following:
Activation Function | Mathematical Expression |
---|---|
Identity | \( f(x)= x \) |
Logistic | \( f(x) = \frac{1}{1 + e^{-x}} \) |
Tanh | \( f(x) = a \cdot tanh(b \cdot x) \) |
Relu | \( f(x) = max(0,x) \) |
Bounded Relu | \( f(x) = min(a, max(0,x)) \) |
Lower-Upper Bounded Relu | \( f(x) = min(a, max(b,x)) \) |
Leaky Relu | \( f(x) = \begin{cases} \alpha x & \quad \text{if } x \text{ < 0}\\ x & \quad \text{if } x \geq \text{ 0 } \end{cases} \) |
Soft Relu | \( f(x)= log(1+e^x) \) |
Soft Elu | \( f(x) = \begin{cases} \alpha (exp(x) - 1) & \quad \text{if } x \text{ < 0}\\ x & \quad \text{if } x \geq \text{ 0 } \end{cases} \) |
Abs | \( f(x)= |x| \) | Square | \( f(x)= x^2 \) | Sqrt | \( f(x) = \sqrt{x} \) | Linear | \( f(x)= ax + b \) | Hard Swish | \( f(x) = (x * relu6(x+3))/6 \) |
Backends:
[in,out] | op | Operator construct to be created if creation was successful |
[in] | ctx | Context to be used for the creation of the operator |
[in] | src | Source tensor descriptor. Slot id: ACL_SRC |
[in] | dst | Destination tensor descriptor. Slot id: ACL_DST |
[in] | info | Activation meta-data |
Returns:
Definition at line 30 of file AclActivation.cpp.
References AclSuccess, ARM_COMPUTE_RETURN_CENUM_ON_FAILURE, ARM_COMPUTE_VALIDATE_OPERATOR_SUPPORT, arm_compute::test::validation::dst, arm_compute::get_internal(), arm_compute::test::validation::info, arm_compute::test::validation::src, and arm_compute::detail::validate_internal_context().
Referenced by Activation::Activation().