From b963383a35ff4532a3d30910abbc0e1661f091af Mon Sep 17 00:00:00 2001 From: xiebaiyuan Date: Wed, 16 Oct 2019 17:59:45 +0800 Subject: [PATCH] support global pooling ... test=develop (#2204) --- mobile/src/operators/kernel/cl/pool_kernel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mobile/src/operators/kernel/cl/pool_kernel.cpp b/mobile/src/operators/kernel/cl/pool_kernel.cpp index ed0731c31b..990f6ea675 100644 --- a/mobile/src/operators/kernel/cl/pool_kernel.cpp +++ b/mobile/src/operators/kernel/cl/pool_kernel.cpp @@ -50,6 +50,14 @@ void PoolKernel::Compute(const PoolParam ¶m) { std::vector ksize = param.Ksize(); std::vector strides = param.Strides(); std::vector paddings = param.Paddings(); + + if (param.isGlobalPooling()) { + for (size_t i = 0; i < ksize.size(); ++i) { + paddings[i] = 0; + ksize[i] = static_cast(param.Input()->dims()[i + 2]); + } + } + const int pad_top = paddings[0]; const int pad_left = paddings[1]; const int stride_h = strides[0]; -- GitLab