From af6204c331eed7894ec4c5fd4e98ec22b6dac676 Mon Sep 17 00:00:00 2001 From: Anton Lokhmotov Date: Wed, 8 Nov 2017 09:34:19 +0000 Subject: COMPMID-661: Add avgpool-uint8 support. Optimize avgpool-fp32 for Bifrost. (#13) Change-Id: I32ba6afbac6694ffa053dd16f03a1b3d14627a19 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94857 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- src/runtime/CL/functions/CLPoolingLayer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/runtime/CL/functions/CLPoolingLayer.cpp') diff --git a/src/runtime/CL/functions/CLPoolingLayer.cpp b/src/runtime/CL/functions/CLPoolingLayer.cpp index 6ca1a33b0c..ac360fbb3d 100644 --- a/src/runtime/CL/functions/CLPoolingLayer.cpp +++ b/src/runtime/CL/functions/CLPoolingLayer.cpp @@ -23,21 +23,33 @@ */ #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" +#include "arm_compute/core/CL/ICLTensor.h" #include "arm_compute/core/CL/kernels/CLPoolingLayerKernel.h" +#include "arm_compute/runtime/CL/CLScheduler.h" #include "support/ToolchainSupport.h" using namespace arm_compute; void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info) { + ARM_COMPUTE_ERROR_ON_NULLPTR(input); + // Configure pooling kernel auto k = arm_compute::support::cpp14::make_unique(); + k->set_target(CLScheduler::get().target()); k->configure(input, output, pool_info); _kernel = std::move(k); // Configure border depending on operation required BorderMode border_mode = (PoolingType::MAX == pool_info.pool_type()) ? BorderMode::REPLICATE : BorderMode::CONSTANT; - _border_handler.configure(input, _kernel->border_size(), border_mode, PixelValue(0)); + // Quantize border in case data type is quantized asymmetric data type + uint32_t border_value = 0; + if(is_data_type_quantized_asymmetric(input->info()->data_type()) && !pool_info.exclude_padding()) + { + border_value = static_cast(input->info()->quantization_info().quantize(0)); + } + + _border_handler.configure(input, _kernel->border_size(), border_mode, PixelValue(border_value)); } Error CLPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) -- cgit v1.2.1