diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2018-04-18 09:49:16 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:50:48 +0000 |
commit | e74b201ca1abca040ca9f30837fdf19aa610e7c4 (patch) | |
tree | 28a9022c564e40a410c66716467d4133574fec7b /src/runtime/CL | |
parent | 2213d4b334567d0cb7f283090d42b5fb1b70f66b (diff) | |
download | ComputeLibrary-e74b201ca1abca040ca9f30837fdf19aa610e7c4.tar.gz |
COMPMID-805 Add NHWC data format support for CL pooling
Change-Id: I3d91fde78b971aba3f6349f633cd9b1c50e5cacf
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/124712
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/runtime/CL')
-rw-r--r-- | src/runtime/CL/functions/CLPoolingLayer.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/runtime/CL/functions/CLPoolingLayer.cpp b/src/runtime/CL/functions/CLPoolingLayer.cpp index 201bf87b47..17875a38ad 100644 --- a/src/runtime/CL/functions/CLPoolingLayer.cpp +++ b/src/runtime/CL/functions/CLPoolingLayer.cpp @@ -41,13 +41,28 @@ void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const Poolin _kernel = std::move(k); // Configure border depending on operation required (quantize border in case of asymmetric data_type) - BorderMode border_mode = (PoolingType::MAX == pool_info.pool_type()) ? BorderMode::REPLICATE : BorderMode::CONSTANT; - PixelValue zero_value(0.f); + BorderMode border_mode{}; + PixelValue pixel_value(0.f); if(is_data_type_quantized_asymmetric(input->info()->data_type()) && !pool_info.exclude_padding()) { - zero_value = PixelValue(static_cast<uint32_t>(input->info()->quantization_info().offset)); + pixel_value = PixelValue(static_cast<uint32_t>(input->info()->quantization_info().offset)); } - _border_handler.configure(input, _kernel->border_size(), border_mode, zero_value); + switch(input->info()->data_layout()) + { + case DataLayout::NCHW: + border_mode = (PoolingType::MAX == pool_info.pool_type()) ? BorderMode::REPLICATE : BorderMode::CONSTANT; + break; + case DataLayout::NHWC: + border_mode = BorderMode::CONSTANT; + if(PoolingType::MAX == pool_info.pool_type() && !is_data_type_quantized_asymmetric(input->info()->data_type())) + { + pixel_value = PixelValue(std::numeric_limits<float>::lowest()); + } + break; + default: + ARM_COMPUTE_ERROR("Data layout not supported"); + } + _border_handler.configure(input, _kernel->border_size(), border_mode, pixel_value); } Status CLPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) |