Skip to content

Commit

Permalink
[ARM][kernel] fix pool_compute.cc "x_dims[-1]" bugs (#4918) (#4930)
Browse files Browse the repository at this point in the history
* [arm][kernels][pooling] pool_compute.cc fix bugs
  • Loading branch information
xingjing1 authored Dec 9, 2020
1 parent 68e64e0 commit 239dc3d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lite/kernels/arm/pool_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void PoolCompute::Run() {
global_pooling = param.global_pooling || global_pooling;
kps_equal = kps_equal && win_ksize;
auto x_dims = param.x->dims();
auto w_in = x_dims[x_dims.size() - 1];

if (global_pooling) {
for (size_t i = 0; i < ksize.size(); ++i) {
Expand Down Expand Up @@ -92,8 +93,8 @@ void PoolCompute::Run() {
return;
}
} else {
if (x_dims[-1] > 8 && ksize[0] == 1 && strides[0] == 2 &&
paddings[0] == 0 && kps_equal) {
if (w_in > 8 && ksize[0] == 1 && strides[0] == 2 && paddings[0] == 0 &&
kps_equal) {
auto& ctx = this->ctx_->template As<ARMContext>();
if (pooling_type == "max") {
lite::arm::math::pooling1x1s2p0_max(din,
Expand All @@ -109,7 +110,7 @@ void PoolCompute::Run() {
paddings[3]);
return;
}
} else if (x_dims[-1] > 8 && ksize[0] == 2 && strides[0] == 2 &&
} else if (w_in > 8 && ksize[0] == 2 && strides[0] == 2 &&
paddings[0] == 0 && kps_equal) {
if (pooling_type == "max") {
lite::arm::math::pooling2x2s2p0_max(din,
Expand Down Expand Up @@ -139,7 +140,7 @@ void PoolCompute::Run() {
paddings[3]);
return;
}
} else if (x_dims[-1] > 8 && ksize[0] == 2 && strides[0] == 2 &&
} else if (w_in > 8 && ksize[0] == 2 && strides[0] == 2 &&
paddings[0] == 1 && kps_equal) {
if (pooling_type == "max") {
lite::arm::math::pooling2x2s2p1_max(din,
Expand Down

0 comments on commit 239dc3d

Please sign in to comment.