From d817647a4fabc8eccd0e64f54465e378a4239b32 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Wed, 4 Dec 2019 09:46:28 +0000 Subject: COMPMID-2767 [NEON] add support for QASYMM8_SIGNED to DequantizationLayer Change-Id: If5b21d1e656b21baf39346c2fd74e8edc75007f5 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/2429 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio --- arm_compute/core/NEON/NEAsymm.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'arm_compute') diff --git a/arm_compute/core/NEON/NEAsymm.h b/arm_compute/core/NEON/NEAsymm.h index 234d48882c..67adcef9b1 100644 --- a/arm_compute/core/NEON/NEAsymm.h +++ b/arm_compute/core/NEON/NEAsymm.h @@ -451,6 +451,30 @@ inline float32x4x4_t vdequantize(const uint8x16_t &qv, float scale, int32_t offs return vdequantized_input; } +/** Dequantize a vector of 16 values stored as signed asymmetric. + * + * @param[in] qv Input values to be dequantized. + * @param[in] scale Quantization scaling factor. + * @param[in] offset Zero quantization offset. + * + * @return Dequantized values in a neon vector + */ +inline float32x4x4_t vdequantize(const int8x16_t &qv, float scale, int32_t offset) +{ + const int32x4_t voffset = vdupq_n_s32(offset); + const float32x4_t vscale = vdupq_n_f32(scale); + const float32x4x4_t vdequantized_input = + { + { + vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale), + vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale), + vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale), + vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale), + } + }; + return vdequantized_input; +} + /** Dequantize following symmetric quantization scheme a neon vector holding 16 quantized values. * * @param[in] qv Input values to be dequantized. -- cgit v1.2.1