aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorgiuros01 <giuseppe.rossini@arm.com>2019-05-14 16:12:53 +0100
committerGiuseppe Rossini <giuseppe.rossini@arm.com>2019-05-24 09:20:27 +0000
commit1e6e1b899c1a88d3466cdc6fd097ccf32ff767e3 (patch)
tree124d00f9b2bd26ddbb5edf8f3bc7102e7494d404 /src/core
parent048b0f300ee729cac1b3019311589c654771fb8f (diff)
downloadComputeLibrary-1e6e1b899c1a88d3466cdc6fd097ccf32ff767e3.tar.gz
COMPMID-2322: PRELU support in CLActivationLayer
Change-Id: I3aa8d4964a1861c2b8acef59dc863df7c48f3316 Signed-off-by: giuros01 <giuseppe.rossini@arm.com> Reviewed-on: https://review.mlplatform.org/c/1146 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CL/CLKernelLibrary.cpp2
-rw-r--r--src/core/CL/cl_kernels/elementwise_operation.cl1
-rw-r--r--src/core/CL/cl_kernels/elementwise_operation_quantized.cl3
-rw-r--r--src/core/CL/kernels/CLElementwiseOperationKernel.cpp1
4 files changed, 6 insertions, 1 deletions
diff --git a/src/core/CL/CLKernelLibrary.cpp b/src/core/CL/CLKernelLibrary.cpp
index 28152168bc..23eac1664a 100644
--- a/src/core/CL/CLKernelLibrary.cpp
+++ b/src/core/CL/CLKernelLibrary.cpp
@@ -253,12 +253,14 @@ const std::map<std::string, std::string> CLKernelLibrary::_kernel_program_map =
{ "elementwise_operation_DIV", "elementwise_operation.cl" },
{ "elementwise_operation_SQUARED_DIFF", "elementwise_operation.cl" },
{ "elementwise_operation_POWER", "elementwise_operation.cl" },
+ { "elementwise_operation_PRELU", "elementwise_operation.cl" },
{ "elementwise_operation_ADD_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_operation_SUB_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_operation_MAX_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_operation_MIN_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_operation_DIV_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_operation_SQUARED_DIFF_quantized", "elementwise_operation_quantized.cl" },
+ { "elementwise_operation_PRELU_quantized", "elementwise_operation_quantized.cl" },
{ "elementwise_unary", "elementwise_unary.cl" },
{ "erode", "erode.cl" },
{ "fast_corners", "fast_corners.cl" },
diff --git a/src/core/CL/cl_kernels/elementwise_operation.cl b/src/core/CL/cl_kernels/elementwise_operation.cl
index 0b660e4012..42d6d33e03 100644
--- a/src/core/CL/cl_kernels/elementwise_operation.cl
+++ b/src/core/CL/cl_kernels/elementwise_operation.cl
@@ -38,6 +38,7 @@
#define SQUARED_DIFF(x, y) (x - y) * (x - y)
#define DIV(x, y) (x / y)
#define POWER(x, y) pow(x, y)
+#define PRELU(x, y) (select(y * x, x, x > (DATA_TYPE_OUT)0))
#define OP_FUN_NAME_STR(op) elementwise_operation_##op
#define OP_FUN_NAME(op) OP_FUN_NAME_STR(op)
diff --git a/src/core/CL/cl_kernels/elementwise_operation_quantized.cl b/src/core/CL/cl_kernels/elementwise_operation_quantized.cl
index 1f0533be13..1b45da164f 100644
--- a/src/core/CL/cl_kernels/elementwise_operation_quantized.cl
+++ b/src/core/CL/cl_kernels/elementwise_operation_quantized.cl
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,6 +28,7 @@
#define MAX(x, y) max((x), (y))
#define MIN(x, y) min((x), (y))
#define SQUARED_DIFF(x, y) (x - y) * (x - y)
+#define PRELU(x, y) (select(y * x, x, x > (DATA_TYPE_OUT)0))
#define DIV(x, y) (x / y)
#define CONVERT_RTE(x, type) (convert_##type##_rte((x)))
diff --git a/src/core/CL/kernels/CLElementwiseOperationKernel.cpp b/src/core/CL/kernels/CLElementwiseOperationKernel.cpp
index ce0c51dac5..414b040f4c 100644
--- a/src/core/CL/kernels/CLElementwiseOperationKernel.cpp
+++ b/src/core/CL/kernels/CLElementwiseOperationKernel.cpp
@@ -43,6 +43,7 @@ std::map<ArithmeticOperation, std::string> supported_arithmetic_ops =
{ ArithmeticOperation::MIN, "MIN" },
{ ArithmeticOperation::MAX, "MAX" },
{ ArithmeticOperation::POWER, "POWER" },
+ { ArithmeticOperation::PRELU, "PRELU" },
};
std::map<ArithmeticOperation, std::string> supported_sat_arithmetic_ops =