From cc1f6c94f1fc3b5d5ccbd5aa43e2a08487664f50 Mon Sep 17 00:00:00 2001 From: morgolock Date: Tue, 24 Mar 2020 09:26:48 +0000 Subject: MLCE-166: Add support for extracting indices in NEPoolingLayer 2x2 NCHW * Added initial support for pooling indices * Only supported for NCHW Poolsize 2 Change-Id: I92ce767e64fcc01aae89411064b4cb2be272a1e9 Signed-off-by: morgolock Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2927 Comments-Addressed: Arm Jenkins Reviewed-by: Georgios Pinitas Reviewed-by: Sang-Hoon Park Tested-by: Arm Jenkins --- src/runtime/CL/functions/CLPoolingLayer.cpp | 9 ++++----- src/runtime/GLES_COMPUTE/functions/GCPoolingLayer.cpp | 13 +++++++------ src/runtime/NEON/functions/NEPoolingLayer.cpp | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/CL/functions/CLPoolingLayer.cpp b/src/runtime/CL/functions/CLPoolingLayer.cpp index ebdae0b8ad..9c4fa4a2ba 100644 --- a/src/runtime/CL/functions/CLPoolingLayer.cpp +++ b/src/runtime/CL/functions/CLPoolingLayer.cpp @@ -30,14 +30,13 @@ namespace arm_compute { -void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info) +void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info, ICLTensor *indices) { 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); + k->configure(input, output, pool_info, indices); _kernel = std::move(k); const DataType data_type = input->info()->data_type(); @@ -81,8 +80,8 @@ void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const Poolin CLScheduler::get().tune_kernel_static(*_kernel); } -Status CLPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) +Status CLPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices) { - return CLPoolingLayerKernel::validate(input, output, pool_info); + return CLPoolingLayerKernel::validate(input, output, pool_info, indices); } } // namespace arm_compute diff --git a/src/runtime/GLES_COMPUTE/functions/GCPoolingLayer.cpp b/src/runtime/GLES_COMPUTE/functions/GCPoolingLayer.cpp index 328c5e9762..accf60e204 100644 --- a/src/runtime/GLES_COMPUTE/functions/GCPoolingLayer.cpp +++ b/src/runtime/GLES_COMPUTE/functions/GCPoolingLayer.cpp @@ -29,18 +29,18 @@ #include "support/MemorySupport.h" -using namespace arm_compute; - +namespace arm_compute +{ GCPoolingLayer::GCPoolingLayer() : _kernel(nullptr), _border_handler(), _shift_handler() { } -void GCPoolingLayer::configure(IGCTensor *input, IGCTensor *output, const PoolingLayerInfo &pool_info) +void GCPoolingLayer::configure(IGCTensor *input, IGCTensor *output, const PoolingLayerInfo &pool_info, IGCTensor *indices) { // Configure pooling kernel auto k = arm_compute::support::cpp14::make_unique(); - k->configure(input, output, pool_info); + k->configure(input, output, pool_info, indices); _kernel = std::move(k); // Configure border depending on operation required @@ -50,9 +50,9 @@ void GCPoolingLayer::configure(IGCTensor *input, IGCTensor *output, const Poolin _shift_handler.configure(input); } -Status GCPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) +Status GCPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices) { - return GCPoolingLayerKernel::validate(input, output, pool_info); + return GCPoolingLayerKernel::validate(input, output, pool_info, indices); } void GCPoolingLayer::run() @@ -63,3 +63,4 @@ void GCPoolingLayer::run() GCScheduler::get().memory_barrier(); GCScheduler::get().dispatch(*_kernel); } +} // namespace arm_compute diff --git a/src/runtime/NEON/functions/NEPoolingLayer.cpp b/src/runtime/NEON/functions/NEPoolingLayer.cpp index 0a3219375e..12921cf40e 100644 --- a/src/runtime/NEON/functions/NEPoolingLayer.cpp +++ b/src/runtime/NEON/functions/NEPoolingLayer.cpp @@ -33,7 +33,7 @@ NEPoolingLayer::NEPoolingLayer() { } -void NEPoolingLayer::configure(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info) +void NEPoolingLayer::configure(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info, ITensor *indices) { // Check if we have Global Pooling Layer _is_global_pooling_layer = (input->info()->dimension(0) == pool_info.pool_size.width) && (input->info()->dimension(1) == pool_info.pool_size.height); @@ -42,7 +42,7 @@ void NEPoolingLayer::configure(ITensor *input, ITensor *output, const PoolingLay _data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : pool_info.data_layout; // Configure pooling kernel - _pooling_layer_kernel.configure(input, output, pool_info); + _pooling_layer_kernel.configure(input, output, pool_info, indices); switch(_data_layout) { @@ -65,9 +65,9 @@ void NEPoolingLayer::configure(ITensor *input, ITensor *output, const PoolingLay } } -Status NEPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) +Status NEPoolingLayer::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices) { - return NEPoolingLayerKernel::validate(input, output, pool_info); + return NEPoolingLayerKernel::validate(input, output, pool_info, indices); } void NEPoolingLayer::run() -- cgit v1.2.1