ArmNN
 21.02
ClFullyConnectedWorkload Class Reference

#include <ClFullyConnectedWorkload.hpp>

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

Public Member Functions

 ClFullyConnectedWorkload (const armnn::FullyConnectedQueueDescriptor &descriptor, const armnn::WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from BaseWorkload< armnn::FullyConnectedQueueDescriptor >
 BaseWorkload (const armnn::FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void PostAllocationConfigure () override
 
const armnn::FullyConnectedQueueDescriptorGetData () const
 
profiling::ProfilingGuid GetGuid () const final
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 

Additional Inherited Members

- Protected Attributes inherited from BaseWorkload< armnn::FullyConnectedQueueDescriptor >
const armnn::FullyConnectedQueueDescriptor m_Data
 
const profiling::ProfilingGuid m_Guid
 

Detailed Description

Definition at line 25 of file ClFullyConnectedWorkload.hpp.

Constructor & Destructor Documentation

◆ ClFullyConnectedWorkload()

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

Definition at line 48 of file ClFullyConnectedWorkload.cpp.

53  : BaseWorkload<FullyConnectedQueueDescriptor>(descriptor, info)
54  , m_FullyConnectedLayer(memoryManager)
55 {
56  m_WeightsTensor = std::make_unique<arm_compute::CLTensor>();
57  BuildArmComputeTensor(*m_WeightsTensor, m_Data.m_Weight->GetTensorInfo());
58 
60  {
61  m_BiasesTensor = std::make_unique<arm_compute::CLTensor>();
62  BuildArmComputeTensor(*m_BiasesTensor, m_Data.m_Bias->GetTensorInfo());
63  }
64 
65  m_Data.ValidateInputsOutputs("ClFullyConnectedWorkload", 1, 1);
66 
67  arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
68  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
69 
70  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
71 
72  arm_compute::FullyConnectedLayerInfo fc_info =
74 
75  m_FullyConnectedLayer.configure(clCompileContext,
76  &input,
77  m_WeightsTensor.get(),
78  m_BiasesTensor.get(),
79  &output,
80  fc_info);
81 
83 
84  if (m_BiasesTensor)
85  {
87  }
88 
89  // Force Compute Library to perform the necessary copying and reshaping, after which
90  // delete all the input tensors that will no longer be needed
91  m_FullyConnectedLayer.prepare();
92  FreeUnusedTensors();
93 }
void InitializeArmComputeClTensorData(arm_compute::CLTensor &clTensor, const ConstCpuTensorHandle *handle)
const ConstCpuTensorHandle * m_Weight
const armnn::FullyConnectedQueueDescriptor m_Data
Definition: Workload.hpp:46
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
bool m_BiasEnabled
Enable/disable bias.
arm_compute::FullyConnectedLayerInfo ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(const FullyConnectedDescriptor &fullyConnectedDesc, const ActivationDescriptor *activationDesc)
std::vector< ITensorHandle * > m_Outputs
std::vector< ITensorHandle * > m_Inputs
const ConstCpuTensorHandle * m_Bias
const TensorInfo & GetTensorInfo() const

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 95 of file ClFullyConnectedWorkload.cpp.

References ARMNN_SCOPED_PROFILING_EVENT_CL, CHECK_LOCATION, and armnn::RunClFunction().

96 {
97  ARMNN_SCOPED_PROFILING_EVENT_CL("ClFullyConnectedWorkload_Execute");
98  RunClFunction(m_FullyConnectedLayer, CHECK_LOCATION());
99 }
#define ARMNN_SCOPED_PROFILING_EVENT_CL(name)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
#define CHECK_LOCATION()
Definition: Exceptions.hpp:197

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