From d5e7e73e1a9800a144b0baab95f71dee15505921 Mon Sep 17 00:00:00 2001 From: HappyAngel Date: Fri, 25 Sep 2020 12:31:21 +0800 Subject: [PATCH] delete ch_four contorl in conv_3x3_dw. test=develop (#4435) --- lite/backends/arm/math/conv3x3s1px_depthwise_fp32.cc | 1 - lite/backends/arm/math/conv_impl.cc | 7 ++----- lite/kernels/arm/conv_depthwise.cc | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lite/backends/arm/math/conv3x3s1px_depthwise_fp32.cc b/lite/backends/arm/math/conv3x3s1px_depthwise_fp32.cc index b4539db98c..25ee9f9404 100644 --- a/lite/backends/arm/math/conv3x3s1px_depthwise_fp32.cc +++ b/lite/backends/arm/math/conv3x3s1px_depthwise_fp32.cc @@ -645,7 +645,6 @@ void conv_3x3s1_depthwise_fp32_bias(const float* i_data, bool flag_bias = param.bias != nullptr; /// get workspace - LOG(INFO) << "conv_3x3s1_depthwise_fp32_bias: "; float* ptr_zero = ctx->workspace_data(); memset(ptr_zero, 0, sizeof(float) * win_round); float* ptr_write = ptr_zero + win_round; diff --git a/lite/backends/arm/math/conv_impl.cc b/lite/backends/arm/math/conv_impl.cc index fa2f85311b..af722fd641 100644 --- a/lite/backends/arm/math/conv_impl.cc +++ b/lite/backends/arm/math/conv_impl.cc @@ -620,10 +620,8 @@ void conv_depthwise_3x3_fp32(const void* din, int pad = pad_w; bool flag_bias = param.bias != nullptr; bool pads_less = ((paddings[1] < 2) && (paddings[3] < 2)); - bool ch_four = ch_in <= 4 * w_in; if (stride == 1) { - if (ch_four && pads_less && (pad_h == pad_w) && - (pad < 2)) { // support pad = [0, 1] + if (pads_less && (pad_h == pad_w) && (pad < 2)) { // support pad = [0, 1] conv_depthwise_3x3s1_fp32(reinterpret_cast(din), reinterpret_cast(dout), num, @@ -656,8 +654,7 @@ void conv_depthwise_3x3_fp32(const void* din, ctx); } } else if (stride == 2) { - if (ch_four && pads_less && pad_h == pad_w && - (pad < 2)) { // support pad = [0, 1] + if (pads_less && pad_h == pad_w && (pad < 2)) { // support pad = [0, 1] conv_depthwise_3x3s2_fp32(reinterpret_cast(din), reinterpret_cast(dout), num, diff --git a/lite/kernels/arm/conv_depthwise.cc b/lite/kernels/arm/conv_depthwise.cc index c5b43a31a0..e04e774cce 100644 --- a/lite/kernels/arm/conv_depthwise.cc +++ b/lite/kernels/arm/conv_depthwise.cc @@ -32,11 +32,10 @@ void DepthwiseConv::PrepareForRun() { auto hin = param.x->dims()[2]; auto win = param.x->dims()[3]; auto paddings = *param.paddings; - bool ch_four = channel <= 4 * win; // select dw conv kernel if (kw == 3) { bool pads_less = ((paddings[1] < 2) && (paddings[3] < 2)); - if (ch_four && pads_less && paddings[0] == paddings[2] && + if (pads_less && paddings[0] == paddings[2] && (paddings[0] == 0 || paddings[0] == 1)) { flag_trans_weights_ = false; } else { -- GitLab