ArmNN
 24.08
ClDepthwiseConvolutionWorkload Class Reference

#include <ClDepthwiseConvolutionWorkload.hpp>

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

Public Member Functions

 ClDepthwiseConvolutionWorkload (const DepthwiseConvolution2dQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from ClBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
 ClBaseWorkload (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 ()
 

Protected Attributes

std::unique_ptr< arm_compute::IFunction > m_DepthwiseConvolutionLayer
 
- Protected Attributes inherited from BaseWorkload< DepthwiseConvolution2dQueueDescriptor >
DepthwiseConvolution2dQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Additional Inherited Members

- Protected Member Functions inherited from ClBaseWorkload< DepthwiseConvolution2dQueueDescriptor >
virtual void Reconfigure ()
 

Detailed Description

Definition at line 24 of file ClDepthwiseConvolutionWorkload.hpp.

Constructor & Destructor Documentation

◆ ClDepthwiseConvolutionWorkload()

ClDepthwiseConvolutionWorkload ( const DepthwiseConvolution2dQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 86 of file ClDepthwiseConvolutionWorkload.cpp.

90  : ClBaseWorkload<DepthwiseConvolution2dQueueDescriptor>(descriptor, info)
91 {
92  m_Data.ValidateInputsOutputs("ClDepthwiseConv2dWorkload", descriptor.m_Parameters.GetNumInputs(), 1);
93 
94  arm_compute::ICLTensor& input = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
95  arm_compute::ICLTensor& output = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
96  arm_compute::ICLTensor& weights = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
97  weights.info()->set_are_values_constant(info.m_InputTensorInfos[1].IsConstant());
98  arm_compute::ITensorInfo* weightsInfo = weights.info();
99  arm_compute::ITensorInfo* inputInfo = input.info();
100  auto weightsShape = weightsInfo->tensor_shape();
101  auto inputShape = inputInfo->tensor_shape();
102 
103  // The PermuteDepthwiseConv2dWeights backend optimization has been performed,
104  // converting weights to have the same data layout as input.
105  unsigned int depthMultiplier =
106  ComputeDepthwiseConv2dDepthMultiplier(m_Data.m_Parameters.m_DataLayout, weightsShape, inputShape);
107 
108  arm_compute::ICLTensor* bias = nullptr;
110  {
111  bias = &PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
112  bias->info()->set_are_values_constant(info.m_InputTensorInfos[2].IsConstant());
113  }
114 
115  const arm_compute::Size2D aclDilationInfo = BuildArmComputeSize2D(
118 
119  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
120  input.info()->set_data_layout(aclDataLayout);
121  weights.info()->set_data_layout(aclDataLayout);
122  output.info()->set_data_layout(aclDataLayout);
123 
124  arm_compute::PadStrideInfo padStrideInfo = BuildArmComputePadStrideInfo(m_Data.m_Parameters);
125 
126  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
127 
128  m_DepthwiseConvolutionLayer = std::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
129 
130  {
131  ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID("ClDepthwiseConvolutionWorkload_configure");
132  static_cast<arm_compute::CLDepthwiseConvolutionLayer*>(m_DepthwiseConvolutionLayer.get())->configure(
133  clCompileContext,
134  &input,
135  &weights,
136  bias,
137  &output,
138  padStrideInfo,
139  depthMultiplier,
140  activationInfo,
141  aclDilationInfo);
142  }
143 
144  // Add details for profiling output
145  WorkloadInfo detailsInfo;
146 
147  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
148  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
149 
150  // Report Profiling Details
151  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClDepthwiseConvolutionWorkload_Construct",
152  descriptor.m_Parameters,
153  detailsInfo,
154  GetGuid());
155 }

References DepthwiseConvolution2dDescriptor::GetNumInputs(), armnn::info, BaseWorkload< DepthwiseConvolution2dQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, and QueueDescriptor::ValidateInputsOutputs().

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Member Data Documentation

◆ m_DepthwiseConvolutionLayer

std::unique_ptr<arm_compute::IFunction> m_DepthwiseConvolutionLayer
protected

The documentation for this class was generated from the following files:
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:447
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
CHECK_LOCATION
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
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_SCOPED_PROFILING_EVENT_CL_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_CL_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: ClWorkloadUtils.hpp:36
armnn::BoostLogSeverityMapping::info
@ info
armnn::ClDepthwiseConvolutionWorkload::m_DepthwiseConvolutionLayer
std::unique_ptr< arm_compute::IFunction > m_DepthwiseConvolutionLayer
Definition: ClDepthwiseConvolutionWorkload.hpp:36
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::RunClFunction
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
Definition: ClWorkloadUtils.hpp:167
armnn::DepthwiseConvolution2dDescriptor::m_DilationX
uint32_t m_DilationX
Dilation factor value for width dimension.
Definition: Descriptors.hpp:704
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26