ArmNN
 21.02
NeonFullyConnectedWorkload Class Reference

#include <NeonFullyConnectedWorkload.hpp>

Inheritance diagram for NeonFullyConnectedWorkload:
BaseWorkload< FullyConnectedQueueDescriptor > IWorkload

Public Member Functions

 NeonFullyConnectedWorkload (const FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager)
 
virtual void Execute () const override
 
- Public Member Functions inherited from BaseWorkload< FullyConnectedQueueDescriptor >
 BaseWorkload (const FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void PostAllocationConfigure () override
 
const 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< FullyConnectedQueueDescriptor >
const FullyConnectedQueueDescriptor m_Data
 
const profiling::ProfilingGuid m_Guid
 

Detailed Description

Definition at line 27 of file NeonFullyConnectedWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonFullyConnectedWorkload()

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

Definition at line 52 of file NeonFullyConnectedWorkload.cpp.

References BaseWorkload< FullyConnectedQueueDescriptor >::m_Data, QueueDescriptor::m_Inputs, QueueDescriptor::m_Outputs, and QueueDescriptor::ValidateInputsOutputs().

54  : BaseWorkload<FullyConnectedQueueDescriptor>(descriptor, info)
55 {
56  m_Data.ValidateInputsOutputs("NeonFullyConnectedWorkload", 1, 1);
57 
58  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
59  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
60 
61  m_WeightsTensor = std::make_unique<arm_compute::Tensor>();
62  BuildArmComputeTensor(*m_WeightsTensor, m_Data.m_Weight->GetTensorInfo());
63 
65  {
66  m_BiasesTensor = std::make_unique<arm_compute::Tensor>();
67  BuildArmComputeTensor(*m_BiasesTensor, m_Data.m_Bias->GetTensorInfo());
68  }
69 
70  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
71 
72  arm_compute::FullyConnectedLayerInfo fc_info =
73  ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(descriptor.m_Parameters, activationInfo);
74 
75  auto layer = std::make_unique<arm_compute::NEFullyConnectedLayer>(memoryManager);
76  layer->configure(&input, m_WeightsTensor.get(), m_BiasesTensor.get(), &output, fc_info);
77  m_FullyConnectedLayer.reset(layer.release());
78 
79  // Allocate
81  {
83  }
84  else
85  {
87  }
88 
89  if (m_BiasesTensor)
90  {
92  {
94  }
95  else
96  {
98  }
99  }
100 
101  // Force Compute Library to perform the necessary copying and reshaping, after which
102  // delete all the input tensors that will no longer be needed
103  m_FullyConnectedLayer->prepare();
104  FreeUnusedTensors();
105 }
const ConstCpuTensorHandle * m_Weight
const 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
DataType GetDataType() const
Definition: Tensor.hpp:194
bool m_BiasEnabled
Enable/disable bias.
arm_compute::FullyConnectedLayerInfo ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(const FullyConnectedDescriptor &fullyConnectedDesc, const ActivationDescriptor *activationDesc)
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, const ConstCpuTensorHandle *handle)
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 107 of file NeonFullyConnectedWorkload.cpp.

References ARMNN_SCOPED_PROFILING_EVENT_NEON.

108 {
109  ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonFullyConnectedWorkload_Execute");
110  m_FullyConnectedLayer->run();
111 }
#define ARMNN_SCOPED_PROFILING_EVENT_NEON(name)

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