From c8de0f588272b0ed558b44ace81b691243a47d55 Mon Sep 17 00:00:00 2001 From: HappyAngel Date: Wed, 29 Jul 2020 06:44:47 -0500 Subject: [PATCH] [arm] fix con_winograd int8 run sgement error (#4006) * fix arm winograd compute segment. test=develop --- lite/backends/arm/math/conv3x3_winograd_int8.cc | 15 +++------------ lite/backends/arm/math/conv_block_utils.h | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lite/backends/arm/math/conv3x3_winograd_int8.cc b/lite/backends/arm/math/conv3x3_winograd_int8.cc index 0b9870730e..d3c54a718e 100644 --- a/lite/backends/arm/math/conv3x3_winograd_int8.cc +++ b/lite/backends/arm/math/conv3x3_winograd_int8.cc @@ -109,6 +109,7 @@ void conv_compute_2x2_3x3_int8(const int8_t* input, auto act_type = act_param.active_type; int flag_act = 0; // relu: 1, relu6: 2, leakey: 3 float alpha[4] = {0.f, 0.f, 0.f, 0.f}; + bool flag_bias = (bias == nullptr) ? false : true; if (act_param.has_active) { if (act_type == lite_api::ActivationType::kRelu) { flag_act = 1; @@ -286,16 +287,7 @@ void conv_compute_2x2_3x3_int8(const int8_t* input, } //*/ } // for block_count - const float* bias_local_ptr = bias; for (int ci = 0; ci < oc_8; ++ci) { - float bias_local[8] = {bias_local_ptr[0], - bias_local_ptr[1], - bias_local_ptr[2], - bias_local_ptr[3], - bias_local_ptr[4], - bias_local_ptr[5], - bias_local_ptr[6], - bias_local_ptr[7]}; write_int32_nchwc8_to_nchw(output_c8 + ci * oc_8_stride, output_ptr, ci * 8, @@ -309,11 +301,10 @@ void conv_compute_2x2_3x3_int8(const int8_t* input, wout, flag_act, alpha, - bias_local, - param.bias, + bias + ci * 8, + flag_bias, zero_ptr, scale + ci * 8); - bias_local_ptr += 8; } } // for num } // conv compute diff --git a/lite/backends/arm/math/conv_block_utils.h b/lite/backends/arm/math/conv_block_utils.h index c72223d2e8..92e01fa998 100644 --- a/lite/backends/arm/math/conv_block_utils.h +++ b/lite/backends/arm/math/conv_block_utils.h @@ -3885,7 +3885,7 @@ inline void write_int32_nchwc8_to_nchw(const int* din, int width, int flag_act, float* alpha, - float* bias, + const float* bias, bool flag_bias, Dtype* trash_ptr, const float* scale) { -- GitLab