提交 230f8451 编写于 作者: F fuzhiye

fix bug of max pooling

上级 fe2c2e83
...@@ -150,12 +150,12 @@ void MaxPooling(const float *input_ptr, float *output_ptr, PoolingParameter *poo ...@@ -150,12 +150,12 @@ void MaxPooling(const float *input_ptr, float *output_ptr, PoolingParameter *poo
int in_channel_offset = in_batch_offset + j * C4NUM; int in_channel_offset = in_batch_offset + j * C4NUM;
int out_channel_offset = out_plane_offset + j * C4NUM; int out_channel_offset = out_plane_offset + j * C4NUM;
#ifdef ENABLE_NEON #ifdef ENABLE_NEON
float32x4_t tmp_max = vdupq_n_f32(FLT_MIN); float32x4_t tmp_max = vdupq_n_f32(-FLT_MAX);
#else #else
float tmp_max1 = FLT_MIN; float tmp_max1 = -FLT_MAX;
float tmp_max2 = FLT_MIN; float tmp_max2 = -FLT_MAX;
float tmp_max3 = FLT_MIN; float tmp_max3 = -FLT_MAX;
float tmp_max4 = FLT_MIN; float tmp_max4 = -FLT_MAX;
#endif #endif
for (int h = 0; h < win_h; h++) { for (int h = 0; h < win_h; h++) {
for (int w = 0; w < win_w; w++) { for (int w = 0; w < win_w; w++) {
...@@ -188,7 +188,7 @@ void MaxPooling(const float *input_ptr, float *output_ptr, PoolingParameter *poo ...@@ -188,7 +188,7 @@ void MaxPooling(const float *input_ptr, float *output_ptr, PoolingParameter *poo
for (int k = channel_s; k < channel; k++) { for (int k = channel_s; k < channel; k++) {
int in_channel_offset = in_batch_offset + k; int in_channel_offset = in_batch_offset + k;
int out_channel_offset = out_plane_offset + k; int out_channel_offset = out_plane_offset + k;
float tmp_max = FLT_MIN; float tmp_max = -FLT_MAX;
for (int h = 0; h < win_h; h++) { for (int h = 0; h < win_h; h++) {
for (int w = 0; w < win_w; w++) { for (int w = 0; w < win_w; w++) {
if ((in_h_index + h) < 0 || (in_h_index + h) >= in_h || (in_w_index + w) < 0 || if ((in_h_index + h) < 0 || (in_h_index + h) >= in_h || (in_w_index + w) < 0 ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册