diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp | 12 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp | 11 |
2 files changed, 22 insertions, 1 deletions
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<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 @@ 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) diff --git a/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp b/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp index d0117d0131..231b8aa445 100644 --- a/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp +++ b/src/runtime/NEON/functions/NEElementwiseUnaryLayer.cpp @@ -74,4 +74,15 @@ Status NELogLayer::validate(const ITensorInfo *input, const ITensorInfo *output) 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 |