From c255aa7df3e61a73cc4af86d21d3b1848653b7a9 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Mon, 13 May 2019 16:26:29 +0100 Subject: COMPMID-2263: Implement NELogLayer Change-Id: Ie2ae8f7a0b1803dae42873201cb643c71b26129f Signed-off-by: Usama Arif Reviewed-on: https://review.mlplatform.org/c/1122 Tested-by: Arm Jenkins Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins --- src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp') diff --git a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp index d62b165727..8678bcd41b 100644 --- a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp +++ b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp @@ -57,6 +57,8 @@ inline ScalarType elementwise_op_scalar(const ScalarType &a) return std::exp(a); case ElementWiseUnary::NEG: return -a; + case ElementWiseUnary::LOG: + return std::log(a); default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -74,13 +76,15 @@ inline VectorType elementwise_op(const VectorType &a) return wrapper::vexpq(a); case ElementWiseUnary::NEG: return wrapper::vneg(a); + case ElementWiseUnary::LOG: + return wrapper::vlog(a); default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } } /* Elementwise operations that are supported for non floats */ -template ::type = 0> +template < ElementWiseUnary op, bool is_float, typename VectorType, typename std::enable_if < !is_float, int >::type = 0 > inline VectorType elementwise_op(const VectorType &a) { switch(op) @@ -190,6 +194,9 @@ void NEElementwiseUnaryKernel::configure(ElementWiseUnary op, const ITensor *inp case ElementWiseUnary::NEG: _function = configure_func(input, output); break; + case ElementWiseUnary::LOG: + _function = configure_func(input, output); + break; default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -202,6 +209,7 @@ Status NEElementwiseUnaryKernel::validate_arguments(ElementWiseUnary op, const I { case ElementWiseUnary::EXP: case ElementWiseUnary::RSQRT: + case ElementWiseUnary::LOG: ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input, 1, DataType::F16, DataType::F32); break; case ElementWiseUnary::NEG: -- cgit v1.2.1