ArmNN
 24.08
NeonPooling2dWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "NeonWorkloadUtils.hpp"
9 
11 
15 
16 #include <arm_compute/runtime/NEON/functions/NEPoolingLayer.h>
17 
18 namespace armnn
19 {
20 using namespace armcomputetensorutils;
21 
23  const TensorInfo& output,
24  const Pooling2dDescriptor& descriptor)
25 {
26  const arm_compute::TensorInfo aclInputInfo =
27  BuildArmComputeTensorInfo(input, descriptor.m_DataLayout);
28  const arm_compute::TensorInfo aclOutputInfo =
29  BuildArmComputeTensorInfo(output, descriptor.m_DataLayout);
30 
31  arm_compute::PoolingLayerInfo layerInfo = BuildArmComputePoolingLayerInfo(descriptor);
32 
33  return arm_compute::NEPoolingLayer::validate(&aclInputInfo, &aclOutputInfo, layerInfo);
34 }
35 
37  const Pooling2dQueueDescriptor& descriptor, const WorkloadInfo& info)
39 {
40  // Report Profiling Details
41  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonPooling2dWorkload_Construct",
42  descriptor.m_Parameters,
43  info,
44  this->GetGuid());
45 
46  m_Data.ValidateInputsOutputs("NeonPooling2dWorkload", 1, 1);
47 
48  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
49  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
50 
51  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
52  input.info()->set_data_layout(aclDataLayout);
53  output.info()->set_data_layout(aclDataLayout);
54 
55  arm_compute::PoolingLayerInfo layerInfo = BuildArmComputePoolingLayerInfo(m_Data.m_Parameters);
56 
57  auto layer = std::make_unique<arm_compute::NEPoolingLayer>();
58  layer->configure(&input, &output, layerInfo);
59  m_PoolingLayer.reset(layer.release());
60 }
61 
63 {
64  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonPooling2dWorkload_Execute");
65  m_PoolingLayer->run();
66 }
67 
68 } //namespace armnn
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:447
armnn::TensorInfo
Definition: Tensor.hpp:152
NeonTensorHandle.hpp
NeonPooling2dWorkload.hpp
armnn::NeonPooling2dWorkload::Execute
void Execute() const override
Definition: NeonPooling2dWorkload.cpp:62
armnn::Pooling2dDescriptor::m_DataLayout
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Definition: Descriptors.hpp:427
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
PolymorphicDowncast.hpp
ArmComputeUtils.hpp
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::Pooling2dQueueDescriptor
Definition: WorkloadData.hpp:197
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< Pooling2dQueueDescriptor >::m_Data
Pooling2dQueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
ArmComputeTensorUtils.hpp
armnn::NeonPooling2dWorkloadValidate
arm_compute::Status NeonPooling2dWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const Pooling2dDescriptor &descriptor)
Definition: NeonPooling2dWorkload.cpp:22
armnn::Pooling2dDescriptor
A Pooling2dDescriptor for the Pooling2dLayer.
Definition: Descriptors.hpp:371
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:33
armnn::NeonPooling2dWorkload::NeonPooling2dWorkload
NeonPooling2dWorkload(const Pooling2dQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonPooling2dWorkload.cpp:36
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26