COMPMID-2254
Implement NEAbsLayer

Change-Id: I88571010d727b2ac8d9fd3838a4d170cf66bf0ce
Signed-off-by: Manuel Bottini <manuel.bottini@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1150
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
diff --git a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp
index 8678bcd..437676d 100644
--- a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp
+++ b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp
@@ -59,6 +59,8 @@
             return -a;
         case ElementWiseUnary::LOG:
             return std::log(a);
+        case ElementWiseUnary::ABS:
+            return std::abs(a);
         default:
             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
     }
@@ -78,6 +80,8 @@
             return wrapper::vneg(a);
         case ElementWiseUnary::LOG:
             return wrapper::vlog(a);
+        case ElementWiseUnary::ABS:
+            return wrapper::vabs(a);
         default:
             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
     }
@@ -91,6 +95,8 @@
     {
         case ElementWiseUnary::NEG:
             return wrapper::vneg(a);
+        case ElementWiseUnary::ABS:
+            return wrapper::vabs(a);
         default:
             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
     }
@@ -197,6 +203,9 @@
         case ElementWiseUnary::LOG:
             _function = configure_func<ElementWiseUnary::LOG>(input, output);
             break;
+        case ElementWiseUnary::ABS:
+            _function = configure_func<ElementWiseUnary::ABS>(input, output);
+            break;
         default:
             ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
     }
@@ -213,10 +222,11 @@
             ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input, 1, DataType::F16, DataType::F32);
             break;
         case ElementWiseUnary::NEG:
+        case ElementWiseUnary::ABS:
             ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input, 1, DataType::F16, DataType::F32, DataType::S32);
             break;
         default:
-            ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
+            ARM_COMPUTE_ERROR("ElementWiseUnary operation not supported");
     }
     // Validate in case of configured output
     if(output.total_size() > 0)
diff --git a/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp b/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp
index d0117d0..231b8aa 100644
--- a/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp
+++ b/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp
@@ -74,4 +74,15 @@
     return NEElementwiseUnaryKernel::validate(ElementWiseUnary::LOG, input, output);
 }
 
+void NEAbsLayer::configure(const ITensor *input, ITensor *output)
+{
+    auto k = arm_compute::support::cpp14::make_unique<NEElementwiseUnaryKernel>();
+    k->configure(ElementWiseUnary::ABS, input, output);
+    _kernel = std::move(k);
+}
+Status NEAbsLayer::validate(const ITensorInfo *input, const ITensorInfo *output)
+{
+    return NEElementwiseUnaryKernel::validate(ElementWiseUnary::ABS, input, output);
+}
+
 } // namespace arm_compute