From 3113a27930b8661e869bc59deff6edcf43cf2cd3 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Thu, 16 May 2019 17:34:14 +0100 Subject: COMPMID-2194: Add identity activation function to GLES Change-Id: I104ce326479850ae512b9cdb2c4aafdc10f490fa Signed-off-by: Usama Arif Reviewed-on: https://review.mlplatform.org/c/1159 Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/core/GLES_COMPUTE/cs_shaders/activation_layer.cs | 7 ++++++- src/core/GLES_COMPUTE/cs_shaders/activation_layer_helpers_cs.h | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/core/GLES_COMPUTE/cs_shaders') diff --git a/src/core/GLES_COMPUTE/cs_shaders/activation_layer.cs b/src/core/GLES_COMPUTE/cs_shaders/activation_layer.cs index 9a1e233624..dd97c1501b 100644 --- a/src/core/GLES_COMPUTE/cs_shaders/activation_layer.cs +++ b/src/core/GLES_COMPUTE/cs_shaders/activation_layer.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -77,6 +77,8 @@ void main(void) data_out = sqrt_op(data); #elif defined(LINEAR) /*LINEAR*/ data_out = linear_op(data); +#elif defined(IDENTITY) /*IDENTITY*/ + data_out = identity_op(data); #else /*LOGISTIC*/ #error Activation function not provided #endif /*LOGISTIC*/ @@ -131,6 +133,9 @@ void main(void) #elif defined(LINEAR) /*LINEAR*/ data_out.x = linear_op(a); data_out.y = linear_op(b); +#elif defined(IDENTITY) /*IDENTITY*/ + data_out.x = identity_op(a); + data_out.y = identity_op(b); #else /*LOGISTIC*/ #error Activation function not provided #endif /*LOGISTIC*/ diff --git a/src/core/GLES_COMPUTE/cs_shaders/activation_layer_helpers_cs.h b/src/core/GLES_COMPUTE/cs_shaders/activation_layer_helpers_cs.h index f43a33fe87..e5a89a830f 100644 --- a/src/core/GLES_COMPUTE/cs_shaders/activation_layer_helpers_cs.h +++ b/src/core/GLES_COMPUTE/cs_shaders/activation_layer_helpers_cs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -117,3 +117,9 @@ float linear_op(float x) { return MLA_OP(float(B_VAL), float(A_VAL), x); } + +// Linear Activation +float identity_op(float x) +{ + return x; +} -- cgit v1.2.1