Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Jan 23, 2025
1 parent 949af57 commit 3a121a6
Showing 1 changed file with 10 additions and 34 deletions.
44 changes: 10 additions & 34 deletions src/layer/arm/dequantize_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit 3a121a6

Please sign in to comment.