From 9f867daf0139a63e981f6c09f61ec6ebc2e12df0 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