From 3a121a6adbddf79ffdcd68505cca0f1d41b9772f Mon Sep 17 00:00:00 2001 From: nihui Date: Thu, 23 Jan 2025 04:41:01 +0000 Subject: [PATCH] w --- src/layer/arm/dequantize_arm.cpp | 44 ++++++++------------------------ 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/layer/arm/dequantize_arm.cpp b/src/layer/arm/dequantize_arm.cpp index 80ef28db17d..77992eb52e0 100644 --- a/src/layer/arm/dequantize_arm.cpp +++ b/src/layer/arm/dequantize_arm.cpp @@ -206,29 +206,17 @@ static void dequantize_bf16s(const int* intptr, unsigned short* ptr, const Mat& // NCNN_LOGE("dequantize_bf16s %d %d %d %d", scale_data_size, bias_data_size, elemcount, elempack); - const float* scale_ptr = scale_data; - - float scale = 0.f; -#if __ARM_NEON - float32x4_t _scale = vdupq_n_f32(); -#endif // __ARM_NEON - - if (scale_data_size == 1 || elempack == 1) - { - scale = scale_ptr[0]; + float scale = scale_data[0]; #if __ARM_NEON - _scale = vdupq_n_f32(scale); -#endif // __ARM_NEON - } - else + float32x4_t _scale = vdupq_n_f32(scale); + if (scale_data_size > 1) { -#if __ARM_NEON if (elempack == 4) { - _scale = vld1q_f32(scale_ptr); + _scale = vld1q_f32((const float*)scale_data); } -#endif // __ARM_NEON } +#endif // __ARM_NEON if (bias_data_size == 0) { @@ -252,29 +240,17 @@ static void dequantize_bf16s(const int* intptr, unsigned short* ptr, const Mat& } else { - const float* bias_ptr = bias_data; - - float bias = 0.f; -#if __ARM_NEON - float32x4_t _bias = vdupq_n_f32(); -#endif // __ARM_NEON - - if (bias_data_size == 1 || elempack == 1) - { - bias = bias_ptr[0]; + float bias = bias_data[0]; #if __ARM_NEON - _bias = vdupq_n_f32(bias); -#endif // __ARM_NEON - } - else + float32x4_t _bias = vdupq_n_f32(bias); + if (bias_data_size > 1) { -#if __ARM_NEON if (elempack == 4) { - _bias = vld1q_f32(bias_ptr); + _bias = vld1q_f32((const float*)bias_data); } -#endif // __ARM_NEON } +#endif // __ARM_NEON int i = 0; #if __ARM_NEON