aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorFreddie Liardet <frederick.liardet@arm.com>2021-05-12 12:09:12 +0100
committerfrederick.liardet <frederick.liardet@arm.com>2021-06-02 10:28:36 +0000
commit2098445ecfcb8379037f8f287e98a897569419b9 (patch)
treeb99886ad2706e5c7471793b992897772550c507a /src/core
parent760b494acdd6c0184e15b86e40256b27d6312b7a (diff)
downloadComputeLibrary-2098445ecfcb8379037f8f287e98a897569419b9.tar.gz
Fix bug in PReluLayer when input is 1xN size
Fix issue where gpu elementwise operation kernel would not compile when input is 1xN size and prelu is the chosen operator. Add relevant tests for 1xN input. Signed-off-by: Freddie Liardet <frederick.liardet@arm.com> Change-Id: If0651cfa399ca1d9c65f2632b75536c7931f27d4 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5760 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CL/cl_kernels/elementwise_operation.cl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/CL/cl_kernels/elementwise_operation.cl b/src/core/CL/cl_kernels/elementwise_operation.cl
index a5b486a882..c8250045dc 100644
--- a/src/core/CL/cl_kernels/elementwise_operation.cl
+++ b/src/core/CL/cl_kernels/elementwise_operation.cl
@@ -39,10 +39,15 @@
#define MIN(x, y) min(x, y)
#define SQUARED_DIFF(x, y) (x - y) * (x - y)
#define POWER(x, y) pow(x, y)
+
+#if VEC_SIZE_OUT == 1
+#define PRELU(x, y) (x > 0 ? x : x * y)
+#else // VEC_SIZE_OUT == 1
#define PRELU(x, y) (select(y * x, x, CONVERT((x > (DATA_TYPE_OUT)0), SELECT_VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT))))
+#endif // VEC_SIZE_OUT == 1
#if defined(S32)
-#define DIV(x, y) CONVERT(floor(CONVERT(x , VEC_DATA_TYPE(float, VEC_SIZE_OUT)) / CONVERT(y , VEC_DATA_TYPE(float, VEC_SIZE_OUT))), VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT));
+#define DIV(x, y) CONVERT(floor(CONVERT(x, VEC_DATA_TYPE(float, VEC_SIZE_OUT)) / CONVERT(y, VEC_DATA_TYPE(float, VEC_SIZE_OUT))), VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT));
#else /* S32 */
#define DIV(x, y) (x / y)
#endif /* S32 */