From 6ac5992dc81534e81482892f8fb8c03790c57192 Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Wed, 15 May 2019 14:06:02 +0100 Subject: COMPMID-2254 Implement NEAbsLayer Change-Id: I88571010d727b2ac8d9fd3838a4d170cf66bf0ce Signed-off-by: Manuel Bottini Reviewed-on: https://review.mlplatform.org/c/1150 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Reviewed-by: Giuseppe Rossini --- src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/core/NEON/kernels') diff --git a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp index 8678bcd41b..437676ddb3 100644 --- a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp +++ b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp @@ -59,6 +59,8 @@ inline ScalarType elementwise_op_scalar(const ScalarType &a) 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 @@ inline VectorType elementwise_op(const VectorType &a) 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 @@ inline VectorType elementwise_op(const VectorType &a) { case ElementWiseUnary::NEG: return wrapper::vneg(a); + case ElementWiseUnary::ABS: + return wrapper::vabs(a); default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -197,6 +203,9 @@ void NEElementwiseUnaryKernel::configure(ElementWiseUnary op, const ITensor *inp case ElementWiseUnary::LOG: _function = configure_func(input, output); break; + case ElementWiseUnary::ABS: + _function = configure_func(input, output); + break; default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -213,10 +222,11 @@ Status NEElementwiseUnaryKernel::validate_arguments(ElementWiseUnary op, const I 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) -- cgit v1.2.1