telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 6 | #include "NeonPooling2dWorkload.hpp" |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 7 | #include <neon/NeonLayerSupport.hpp> |
| 8 | #include <neon/NeonTensorHandle.hpp> |
| 9 | #include <aclCommon/ArmComputeUtils.hpp> |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | using namespace armcomputetensorutils; |
| 15 | |
| 16 | arm_compute::Status NeonPooling2dWorkloadValidate(const TensorInfo& input, |
| 17 | const TensorInfo& output, |
| 18 | const Pooling2dDescriptor& descriptor) |
| 19 | { |
James Conroy | 6948227 | 2018-10-19 10:41:35 +0100 | [diff] [blame] | 20 | const arm_compute::TensorInfo aclInputInfo = |
Matthew Bentham | 8800c00 | 2018-11-19 13:19:28 +0000 | [diff] [blame] | 21 | BuildArmComputeTensorInfo(input, descriptor.m_DataLayout); |
James Conroy | 6948227 | 2018-10-19 10:41:35 +0100 | [diff] [blame] | 22 | const arm_compute::TensorInfo aclOutputInfo = |
Matthew Bentham | 8800c00 | 2018-11-19 13:19:28 +0000 | [diff] [blame] | 23 | BuildArmComputeTensorInfo(output, descriptor.m_DataLayout); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | |
| 25 | arm_compute::PoolingLayerInfo layerInfo = BuildArmComputePoolingLayerInfo(descriptor); |
| 26 | |
| 27 | return arm_compute::NEPoolingLayer::validate(&aclInputInfo, &aclOutputInfo, layerInfo); |
| 28 | } |
| 29 | |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 30 | NeonPooling2dWorkload::NeonPooling2dWorkload( |
| 31 | const Pooling2dQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 32 | : BaseWorkload<Pooling2dQueueDescriptor>(descriptor, info) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 33 | { |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 34 | m_Data.ValidateInputsOutputs("NeonPooling2dWorkload", 1, 1); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 35 | |
| 36 | arm_compute::ITensor& input = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 37 | arm_compute::ITensor& output = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 38 | |
Matthew Bentham | 8800c00 | 2018-11-19 13:19:28 +0000 | [diff] [blame] | 39 | arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout); |
Francis Murtagh | 043d0d0 | 2018-10-05 14:08:48 +0100 | [diff] [blame] | 40 | input.info()->set_data_layout(aclDataLayout); |
| 41 | output.info()->set_data_layout(aclDataLayout); |
| 42 | |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 43 | arm_compute::PoolingLayerInfo layerInfo = BuildArmComputePoolingLayerInfo(m_Data.m_Parameters); |
| 44 | |
| 45 | m_PoolingLayer.configure(&input, &output, layerInfo); |
| 46 | } |
| 47 | |
Nattapat Chaimanowong | 5d2e700 | 2018-10-12 16:03:56 +0100 | [diff] [blame] | 48 | void NeonPooling2dWorkload::Execute() const |
| 49 | { |
| 50 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonPooling2dWorkload_Execute"); |
| 51 | m_PoolingLayer.run(); |
| 52 | } |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 53 | |
| 54 | } //namespace armnn |