ArmNN
 24.02
NeonDepthwiseConvolutionWorkload Class Reference

#include <NeonDepthwiseConvolutionWorkload.hpp>

Inheritance diagram for NeonDepthwiseConvolutionWorkload:
[legend]
Collaboration diagram for NeonDepthwiseConvolutionWorkload:
[legend]

Public Member Functions

 NeonDepthwiseConvolutionWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
 NeonBaseWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from BaseWorkload< DepthwiseConvolution2dQueueDescriptor >
 BaseWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const DepthwiseConvolution2dQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const override
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual arm::pipe::ProfilingGuid GetGuid () const =0
 
virtual bool SupportsTensorHandleReplacement () const =0
 
virtual const std::string & GetName () const =0
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 
virtual armnn::Optional< armnn::MemoryRequirementsGetMemoryRequirements ()
 

Additional Inherited Members

- Protected Member Functions inherited from NeonBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< DepthwiseConvolution2dQueueDescriptor >
DepthwiseConvolution2dQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 26 of file NeonDepthwiseConvolutionWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonDepthwiseConvolutionWorkload()

Definition at line 87 of file NeonDepthwiseConvolutionWorkload.cpp.

91 {
92  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
93  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
94  arm_compute::ITensor& weights = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
95  weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
96  arm_compute::ITensor* biasesPtr = nullptr;
98  {
99  biasesPtr = &PolymorphicDowncast<IAclTensorHandle *>(m_Data.m_Inputs[2])->GetTensor();
100  biasesPtr->info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
101  }
102 
103  arm_compute::TensorShape weightsShape = weights.info()->tensor_shape();
104  arm_compute::TensorShape inputShape = input.info()->tensor_shape();
105 
106  // The PermuteDepthwiseConv2dWeights backend optimization has been performed,
107  // converting weights to have the same data layout as input.
108  unsigned int depthMultiplier =
109  ComputeDepthwiseConv2dDepthMultiplier(m_Data.m_Parameters.m_DataLayout, weightsShape, inputShape);
110 
111  const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(m_Data.m_Parameters.m_DilationX,
113 
114  uint32_t numInputs = m_Data.m_Parameters.m_BiasEnabled ? 3: 2;
115  m_Data.ValidateInputsOutputs("NeonDepthwiseConvolutionWorkload", numInputs, 1);
116 
117  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
118  input.info()->set_data_layout(aclDataLayout);
119  weights.info()->set_data_layout(aclDataLayout);
120  output.info()->set_data_layout(aclDataLayout);
121 
122  const arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(m_Data.m_Parameters);
123 
124  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
125 
126  m_pDepthwiseConvolutionLayer = std::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
127  static_cast<arm_compute::NEDepthwiseConvolutionLayer*>(
128  m_pDepthwiseConvolutionLayer.get())->configure(&input,
129  &weights,
130  biasesPtr,
131  &output,
132  padStrideInfo,
133  depthMultiplier,
134  activationInfo,
135  aclDilationInfo);
136 
137  // Add details for profiling output
138  WorkloadInfo detailsInfo;
139 
140  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
141  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
142 
143  // Report Profiling Details
144  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonDepthwiseConvolution2dWorkload_Construct",
145  descriptor.m_Parameters,
146  detailsInfo,
147  GetGuid());
148 
149  ARMNN_ASSERT(m_pDepthwiseConvolutionLayer);
150 
151  m_pDepthwiseConvolutionLayer->prepare();
152 }

References armnn::info, DepthwiseConvolution2dDescriptor::m_BiasEnabled, BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 154 of file NeonDepthwiseConvolutionWorkload.cpp.

155 {
156  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonDepthwiseConvolutionWorkload_Execute");
157  ARMNN_ASSERT(m_pDepthwiseConvolutionLayer);
158 
159  m_pDepthwiseConvolutionLayer->run();
160 }

References ARMNN_ASSERT, and ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.


The documentation for this class was generated from the following files:
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::DepthwiseConvolution2dDescriptor::m_BiasEnabled
bool m_BiasEnabled
Enable/disable bias.
Definition: Descriptors.hpp:708
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::ConvertAdditionalInfoToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
Definition: ArmComputeUtils.hpp:105
armnn::DepthwiseConvolution2dDescriptor::m_DataLayout
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Definition: Descriptors.hpp:710
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::DepthwiseConvolution2dDescriptor::m_DilationY
uint32_t m_DilationY
Dilation factor value for height dimension.
Definition: Descriptors.hpp:706
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
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::BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::GetGuid
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:67
armnn::BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::m_Data
DepthwiseConvolution2dQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
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:32
armnn::DepthwiseConvolution2dDescriptor::m_DilationX
uint32_t m_DilationX
Dilation factor value for width dimension.
Definition: Descriptors.hpp:704
armnn::NeonBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26