From 199982fc01bcce10120cd6df03d11829a215c85c Mon Sep 17 00:00:00 2001 From: Milos Puzovic Date: Fri, 28 Oct 2022 00:09:32 +0100 Subject: Add threshold for floating-point SOFT_RELU activation Added missing threshold for calculating SOFT_RELU when SVE and CL implementations are used. As a result removed from the testing bounds for input values that were set to be in the interval [-40, 40]. Resolves: COMPMID-5658 Signed-off-by: Milos Puzovic Change-Id: I3d14df60125e36e4eb85aeb222f4fb0cc5741521 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8536 Comments-Addressed: Arm Jenkins Reviewed-by: Viet-Hoa Do Reviewed-by: Gunes Bayir Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- src/core/CL/cl_kernels/activation_float_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/CL/cl_kernels/activation_float_helpers.h') diff --git a/src/core/CL/cl_kernels/activation_float_helpers.h b/src/core/CL/cl_kernels/activation_float_helpers.h index 3f93c8d6fc..fe124bc032 100644 --- a/src/core/CL/cl_kernels/activation_float_helpers.h +++ b/src/core/CL/cl_kernels/activation_float_helpers.h @@ -52,7 +52,7 @@ #define lrelu_op(DATA_TYPE, VEC_SIZE, x, A_VAL, B_VAL) ((min(x, (DATA_TYPE)0.0) * (DATA_TYPE)A_VAL) + max(x, (DATA_TYPE)0.0)) // Soft RELU Activation -#define srelu_op(DATA_TYPE, VEC_SIZE, x, A_VAL, B_VAL) (log((DATA_TYPE)1.0 + exp(x))) +#define srelu_op(DATA_TYPE, VEC_SIZE, x, A_VAL, B_VAL) (select((log((DATA_TYPE)1.0 + exp(x))), x, (SELECT_VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE))isgreaterequal(x,(DATA_TYPE)16.63553047))) // ELU Activation #define elu_op(DATA_TYPE, VEC_SIZE, x, A_VAL, B_VAL) (select(((DATA_TYPE)A_VAL * (exp(x) - (DATA_TYPE)1.0)), x, (SELECT_VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE))isgreaterequal(x, (DATA_TYPE)0.0))) -- cgit v1.2.1