aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CL/cl_kernels/elementwise_unary.cl12
-rw-r--r--src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp11
-rw-r--r--src/runtime/CL/functions/CLElementWiseUnaryLayer.cpp11
3 files changed, 25 insertions, 9 deletions
diff --git a/src/core/CL/cl_kernels/elementwise_unary.cl b/src/core/CL/cl_kernels/elementwise_unary.cl
index 14d6f5dbe1..89bffed16d 100644
--- a/src/core/CL/cl_kernels/elementwise_unary.cl
+++ b/src/core/CL/cl_kernels/elementwise_unary.cl
@@ -26,14 +26,16 @@
#if defined(DATA_TYPE) && defined(OPERATION)
-// Calculate Exponential
-#define exponential(input) exp(input)
+// Calculate exponential
+#define exp_op(input) exp(input)
// Calculate reverse square root
-#define inverse_sqrt(input) rsqrt(input)
+#define rsqrt_op(input) rsqrt(input)
// Calculate negative
-#define neg(input) (-input)
+#define neg_op(input) (-input)
// Calculate sine
-#define sine(input) sin(input)
+#define sin_op(input) sin(input)
+// Calculate abs for floating point values
+#define fabs_op(input) fabs(input)
/** Applies element wise unary operator in a tensor.
*
diff --git a/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp b/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp
index b6484ec737..15823b06ce 100644
--- a/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp
+++ b/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp
@@ -79,16 +79,19 @@ void CLElementWiseUnaryLayerKernel::configure(const ICLTensor *input, ICLTensor
switch(op)
{
case ElementWiseUnary::RSQRT:
- build_opts.add_option("-DOPERATION=inverse_sqrt");
+ build_opts.add_option("-DOPERATION=rsqrt_op");
break;
case ElementWiseUnary::EXP:
- build_opts.add_option("-DOPERATION=exponential");
+ build_opts.add_option("-DOPERATION=exp_op");
break;
case ElementWiseUnary::NEG:
- build_opts.add_option("-DOPERATION=neg");
+ build_opts.add_option("-DOPERATION=neg_op");
break;
case ElementWiseUnary::SIN:
- build_opts.add_option("-DOPERATION=sine");
+ build_opts.add_option("-DOPERATION=sin_op");
+ break;
+ case ElementWiseUnary::ABS:
+ build_opts.add_option("-DOPERATION=fabs_op");
break;
default:
ARM_COMPUTE_ERROR("Not implemented");
diff --git a/src/runtime/CL/functions/CLElementWiseUnaryLayer.cpp b/src/runtime/CL/functions/CLElementWiseUnaryLayer.cpp
index c3e472d11b..14e77eadce 100644
--- a/src/runtime/CL/functions/CLElementWiseUnaryLayer.cpp
+++ b/src/runtime/CL/functions/CLElementWiseUnaryLayer.cpp
@@ -74,4 +74,15 @@ Status CLSinLayer::validate(const ITensorInfo *input, const ITensorInfo *output)
return CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::SIN);
}
+void CLAbsLayer::configure(const ICLTensor *input, ICLTensor *output)
+{
+ auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>();
+ k->configure(input, output, ElementWiseUnary::ABS);
+ _kernel = std::move(k);
+}
+Status CLAbsLayer::validate(const ITensorInfo *input, const ITensorInfo *output)
+{
+ return CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::ABS);
+}
+
} // namespace arm_compute