ArmNN
 22.05
ClFullyConnectedWorkload Class Reference

#include <ClFullyConnectedWorkload.hpp>

Inheritance diagram for ClFullyConnectedWorkload:
ClBaseWorkload< FullyConnectedQueueDescriptor > BaseWorkload< FullyConnectedQueueDescriptor > IWorkload

Public Member Functions

 ClFullyConnectedWorkload (const FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from ClBaseWorkload< FullyConnectedQueueDescriptor >
 ClBaseWorkload (const FullyConnectedQueueDescriptor &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< FullyConnectedQueueDescriptor >
 BaseWorkload (const FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ExecuteAsync (WorkingMemDescriptor &workingMemDescriptor) override
 
void PostAllocationConfigure () override
 
const FullyConnectedQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const override
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 

Additional Inherited Members

- Protected Member Functions inherited from ClBaseWorkload< FullyConnectedQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< FullyConnectedQueueDescriptor >
FullyConnectedQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 

Detailed Description

Definition at line 25 of file ClFullyConnectedWorkload.hpp.

Constructor & Destructor Documentation

◆ ClFullyConnectedWorkload()

ClFullyConnectedWorkload ( const FullyConnectedQueueDescriptor descriptor,
const WorkloadInfo info,
std::shared_ptr< arm_compute::MemoryManagerOnDemand > &  memoryManager,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 64 of file ClFullyConnectedWorkload.cpp.

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, ARMNN_SCOPED_PROFILING_EVENT, armnn::ConvertAdditionalInfoToAclActivationLayerInfo(), armnn::ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(), FullyConnectedDescriptor::GetNumInputs(), ConstTensorHandle::GetTensorInfo(), FullyConnectedQueueDescriptor::m_Bias, FullyConnectedDescriptor::m_BiasEnabled, WorkloadInfo::m_BiasTensorInfo, BaseWorkload< FullyConnectedQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, WorkloadInfo::m_InputTensorInfos, QueueDescriptor::m_Outputs, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters, FullyConnectedQueueDescriptor::m_Weight, WorkloadInfo::m_WeightsTensorInfo, armnn::Undefined, and QueueDescriptor::ValidateInputsOutputs().

69  : ClBaseWorkload<FullyConnectedQueueDescriptor>(descriptor, info), m_FullyConnectedLayer(memoryManager)
70 {
71  // Add details for profiling output
72  WorkloadInfo detailsInfo;
73 
74  detailsInfo.m_InputTensorInfos = info.m_InputTensorInfos;
75  detailsInfo.m_OutputTensorInfos = info.m_OutputTensorInfos;
76  detailsInfo.m_WeightsTensorInfo = armnn::Optional<armnn::TensorInfo>(descriptor.m_Weight->GetTensorInfo());
77  if (descriptor.m_Parameters.m_BiasEnabled)
78  {
79  detailsInfo.m_BiasTensorInfo = armnn::Optional<armnn::TensorInfo>(descriptor.m_Bias->GetTensorInfo());
80  }
81 
82  // Report Profiling Details
83  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClFullyConnectedWorkload_Construct",
84  descriptor.m_Parameters,
85  detailsInfo,
86  this->GetGuid());
87 
88  m_Data.ValidateInputsOutputs("ClFullyConnectedWorkload", descriptor.m_Parameters.GetNumInputs(),
89  1);
90 
91  arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
92  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
93  arm_compute::ICLTensor& weights = PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
94 
95  arm_compute::ICLTensor* bias = nullptr;
97  {
98  bias = &PolymorphicDowncast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
99  }
100 
101  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
102 
103  arm_compute::FullyConnectedLayerInfo fc_info =
105  activationInfo);
106 
107  {
108  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClFullyConnectedWorkload_configure");
109  m_FullyConnectedLayer.configure(clCompileContext,
110  &input,
111  &weights,
112  bias,
113  &output,
114  fc_info);
115  }
116 }
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
bool m_BiasEnabled
Enable/disable bias.
arm_compute::FullyConnectedLayerInfo ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(const FullyConnectedDescriptor &fullyConnectedDesc, const ActivationDescriptor *activationDesc)
std::vector< ITensorHandle * > m_Outputs
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
std::vector< ITensorHandle * > m_Inputs

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 118 of file ClFullyConnectedWorkload.cpp.

References ARMNN_SCOPED_PROFILING_EVENT_CL_GUID, CHECK_LOCATION, BaseWorkload< FullyConnectedQueueDescriptor >::GetGuid(), and armnn::RunClFunction().

119 {
120  ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClFullyConnectedWorkload_Execute", this->GetGuid());
121  RunClFunction(m_FullyConnectedLayer, CHECK_LOCATION());
122 }
#define ARMNN_SCOPED_PROFILING_EVENT_CL_GUID(name, guid)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:59
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203

The documentation for this class was generated from the following files: