diff options
author | morgolock <pablo.tello@arm.com> | 2020-03-04 14:57:46 +0000 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2020-03-10 18:01:33 +0000 |
commit | 6b3865ad038d60a126fe1f90df815a480527a29f (patch) | |
tree | 5f363b89bde5fc0ca98cf12d2ef82fafe1cb0bd4 /src/core/CL/cl_kernels/activation_float_helpers.h | |
parent | ce3a7b27f80960e88415bb6cabbb75de2239cea8 (diff) | |
download | ComputeLibrary-6b3865ad038d60a126fe1f90df815a480527a29f.tar.gz |
COMPMID-3080: Implement Hard-Swish activation in CL
Change-Id: I5ed35a5e0fba09791e4371b1a74108a1fdfed900
Signed-off-by: morgolock <pablo.tello@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2848
Reviewed-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/cl_kernels/activation_float_helpers.h')
-rw-r--r-- | src/core/CL/cl_kernels/activation_float_helpers.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/CL/cl_kernels/activation_float_helpers.h b/src/core/CL/cl_kernels/activation_float_helpers.h index 0c82f83dbc..8590f25635 100644 --- a/src/core/CL/cl_kernels/activation_float_helpers.h +++ b/src/core/CL/cl_kernels/activation_float_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -29,6 +29,10 @@ #else // GPU_ARCH == GPU_ARCH_BIFROST #define MLA(a, b, c) ((b) * (c) + (a)) #endif // GPU_ARCH == GPU_ARCH_BIFROST + +// Hard-Swish +#define hard_swish_op(DATA_TYPE, x, A_VAL, B_VAL) (x * ((min(max((x + (DATA_TYPE)3.0), (DATA_TYPE)0.0), (DATA_TYPE)6.0)) * (DATA_TYPE)0.166666667)) + // Logistic Activation #define logistic_op(DATA_TYPE, x, A_VAL, B_VAL) ((DATA_TYPE)1.0 / ((DATA_TYPE)1.0 + exp(-x))) |