From b84df20f17f1fe8d098fb8531543c263541355de Mon Sep 17 00:00:00 2001 From: Ramy Elgammal Date: Wed, 12 Apr 2023 17:31:10 +0100 Subject: Fix unhandled case in ElementwiseUnary - Case: when the dequantized float value < 0.f the unary op was not called if operator is not LOG or RSQRT Resolves: COMPMID-5994 Signed-off-by: Ramy Elgammal Change-Id: I24d69db22042701f506188ace91ea4ab3dafeccf Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9437 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Viet-Hoa Do Reviewed-by: Gunes Bayir --- src/cpu/kernels/elementwise_unary/generic/neon/impl.cpp | 8 ++++++++ src/cpu/kernels/elementwise_unary/list.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/cpu/kernels/elementwise_unary') diff --git a/src/cpu/kernels/elementwise_unary/generic/neon/impl.cpp b/src/cpu/kernels/elementwise_unary/generic/neon/impl.cpp index 2b23e46f40..1b449340ba 100644 --- a/src/cpu/kernels/elementwise_unary/generic/neon/impl.cpp +++ b/src/cpu/kernels/elementwise_unary/generic/neon/impl.cpp @@ -183,6 +183,10 @@ void elementwise_op(const ITensor *in, ITensor *out, const Window &windo { tmp_f = (127 - qi_out.offset) * qi_out.scale; } + else + { + tmp_f = elementwise_op_scalar_imp(op, tmp_f); + } } else { @@ -263,6 +267,10 @@ void elementwise_op(const ITensor *in, ITensor *out, const Window &wind { tmp_f = (255 - qi_out.offset) * qi_out.scale; } + else + { + tmp_f = elementwise_op_scalar_imp(op, tmp_f); + } } else { diff --git a/src/cpu/kernels/elementwise_unary/list.h b/src/cpu/kernels/elementwise_unary/list.h index c1cfbb8a3a..432fabf4af 100644 --- a/src/cpu/kernels/elementwise_unary/list.h +++ b/src/cpu/kernels/elementwise_unary/list.h @@ -42,9 +42,10 @@ DECLARE_ELEMETWISE_UNARY_KERNEL(neon_fp32_elementwise_unary); DECLARE_ELEMETWISE_UNARY_KERNEL(neon_fp16_elementwise_unary); DECLARE_ELEMETWISE_UNARY_KERNEL(neon_s32_elementwise_unary); DECLARE_ELEMETWISE_UNARY_KERNEL(neon_q8_elementwise_unary); +#ifndef __aarch64__ DECLARE_ELEMETWISE_UNARY_KERNEL(neon_qasymm8_signed_elementwise_unary); DECLARE_ELEMETWISE_UNARY_KERNEL(neon_qasymm8_elementwise_unary); - +#endif // __aarch64__ #undef DECLARE_ELEMETWISE_UNARY_KERNEL } // namespace cpu -- cgit v1.2.1