aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/cl_kernels/activation_layer_qa8.cl
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-01-22 17:26:36 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:43:42 +0000
commita1f7e33e10e14e7b44913d3dbb794bbd9588a1ad (patch)
tree2f4a66faa20c2fa650dafb957f3a7c6c0c80cbe5 /src/core/CL/cl_kernels/activation_layer_qa8.cl
parent9efceafe007cddb52c8555f6fe847c81e7ad0cba (diff)
downloadComputeLibrary-a1f7e33e10e14e7b44913d3dbb794bbd9588a1ad.tar.gz
COMPMID-841: Add CL QASYMM8 RELU Activation
Change-Id: I8e0b7cad2f977942224d0116e8498bf9b2d6014d Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/117229 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/cl_kernels/activation_layer_qa8.cl')
-rw-r--r--src/core/CL/cl_kernels/activation_layer_qa8.cl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/CL/cl_kernels/activation_layer_qa8.cl b/src/core/CL/cl_kernels/activation_layer_qa8.cl
index 02668f7ac1..cb31e99efb 100644
--- a/src/core/CL/cl_kernels/activation_layer_qa8.cl
+++ b/src/core/CL/cl_kernels/activation_layer_qa8.cl
@@ -25,10 +25,15 @@
#define TYPE VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
+// RELU Activation
+inline TYPE relu_op(TYPE x)
+{
+ return max((TYPE)CONST_0, x);
+}
// Bounded RELU Activation
inline TYPE brelu_op(TYPE x)
{
- return min((TYPE)A_VAL, max(0, x));
+ return min((TYPE)A_VAL, max(CONST_0, x));
}
// Lower Upper Bounded RELU Activation
inline TYPE lu_brelu_op(TYPE x)
@@ -49,6 +54,7 @@ inline TYPE lu_brelu_op(TYPE x)
* @note A, B variables required by some activation functions are set using -DA_VAL= and -DB_VAL= respectively.
* @note Quantization scales of the input/output tensors are passed in with -DS1_VAL= and -DS2_VAL= respectively.
* @note Quantization offsets of the input/output tensors are passed in with -DO1_VAL= and -DO2_VAL= respectively.
+ * @note Quantized value of constant zero should be given as a preprocessor argument using -DCONST_0=value. e.g. -DCONST_0=128.
*
* @param[in] input_ptr Pointer to the source image. Supported data types: QASYMM8
* @param[in] input_stride_x Stride of the source image in X dimension (in bytes)