diff options
author | Usama Arif <usama.arif@arm.com> | 2019-05-23 14:20:33 +0100 |
---|---|---|
committer | Usama Arif <usama.arif@arm.com> | 2019-05-24 16:11:16 +0000 |
commit | 0a5a57a3f794de851408bae1c63b1660b4c5cbe7 (patch) | |
tree | 5d49d85165a3d9fd257c5676691fc5ae24fda4f3 /src/core/NEON/kernels | |
parent | 43c1bf8e47098d6ab07be5b5e685bda6d8b80344 (diff) | |
download | ComputeLibrary-0a5a57a3f794de851408bae1c63b1660b4c5cbe7.tar.gz |
COMPMID-2160: Implement Round for NEON
Change-Id: Ie80e2ad294eaf95bc823d979842c320e8fb41f67
Signed-off-by: Usama Arif <usama.arif@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1215
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels')
-rw-r--r-- | src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp | 9 | ||||
-rw-r--r-- | src/core/NEON/kernels/NEReductionOperationKernel.cpp | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp index 437676ddb3..4419169b23 100644 --- a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp +++ b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp @@ -30,6 +30,7 @@ #include "arm_compute/core/ITensor.h" #include "arm_compute/core/NEON/NEAsymm.h" #include "arm_compute/core/NEON/NEFixedPoint.h" +#include "arm_compute/core/NEON/NEMath.h" #include "arm_compute/core/NEON/wrapper/wrapper.h" #include "arm_compute/core/TensorInfo.h" #include "arm_compute/core/Validate.h" @@ -61,6 +62,8 @@ inline ScalarType elementwise_op_scalar(const ScalarType &a) return std::log(a); case ElementWiseUnary::ABS: return std::abs(a); + case ElementWiseUnary::ROUND: + return std::nearbyint(a); default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -82,6 +85,8 @@ inline VectorType elementwise_op(const VectorType &a) return wrapper::vlog(a); case ElementWiseUnary::ABS: return wrapper::vabs(a); + case ElementWiseUnary::ROUND: + return wrapper::vround(a); default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -206,6 +211,9 @@ void NEElementwiseUnaryKernel::configure(ElementWiseUnary op, const ITensor *inp case ElementWiseUnary::ABS: _function = configure_func<ElementWiseUnary::ABS>(input, output); break; + case ElementWiseUnary::ROUND: + _function = configure_func<ElementWiseUnary::ROUND>(input, output); + break; default: ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); } @@ -219,6 +227,7 @@ Status NEElementwiseUnaryKernel::validate_arguments(ElementWiseUnary op, const I case ElementWiseUnary::EXP: case ElementWiseUnary::RSQRT: case ElementWiseUnary::LOG: + case ElementWiseUnary::ROUND: ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&input, 1, DataType::F16, DataType::F32); break; case ElementWiseUnary::NEG: diff --git a/src/core/NEON/kernels/NEReductionOperationKernel.cpp b/src/core/NEON/kernels/NEReductionOperationKernel.cpp index e6edf22083..c6e853659c 100644 --- a/src/core/NEON/kernels/NEReductionOperationKernel.cpp +++ b/src/core/NEON/kernels/NEReductionOperationKernel.cpp @@ -180,6 +180,7 @@ inline uint8x8_t calculate_max(uint8x16_t in) return wrapper::vpmax(pmax, pmax); } +template <> uint32_t calculate_vector_index(uint32x4x4_t vec_res_idx, uint8x16_t vec_res_value, ReductionOperation op) { uint32x4x4_t res_idx_mask{ { 0 } }; @@ -272,6 +273,7 @@ inline float16x4_t calculate_max(float16x8_t in) return wrapper::vpmax(pmax, pmax); } +template <> uint32_t calculate_vector_index(uint32x4x4_t vec_res_idx, float16x8_t vec_res_value, ReductionOperation op) { uint32x4x2_t res_idx_mask{ 0 }; |