ArmNN
 21.05
ClQuantizedLstmWorkload Class Reference

#include <ClQuantizedLstmWorkload.hpp>

Inheritance diagram for ClQuantizedLstmWorkload:
BaseWorkload< QuantizedLstmQueueDescriptor > IWorkload

Public Member Functions

 ClQuantizedLstmWorkload (const QuantizedLstmQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
 
void Execute () const override
 
- Public Member Functions inherited from BaseWorkload< QuantizedLstmQueueDescriptor >
 BaseWorkload (const QuantizedLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ExecuteAsync (WorkingMemDescriptor &workingMemDescriptor) override
 
void PostAllocationConfigure () override
 
const QuantizedLstmQueueDescriptorGetData () 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< QuantizedLstmQueueDescriptor >
QuantizedLstmQueueDescriptor m_Data
 
const profiling::ProfilingGuid m_Guid
 

Detailed Description

Definition at line 22 of file ClQuantizedLstmWorkload.hpp.

Constructor & Destructor Documentation

◆ ClQuantizedLstmWorkload()

ClQuantizedLstmWorkload ( const QuantizedLstmQueueDescriptor descriptor,
const WorkloadInfo info,
const arm_compute::CLCompileContext &  clCompileContext 
)

Definition at line 64 of file ClQuantizedLstmWorkload.cpp.

66  :
67  BaseWorkload<QuantizedLstmQueueDescriptor>(descriptor, info)
68 {
69  m_InputToInputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
70  BuildArmComputeTensor(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights->GetTensorInfo());
71 
72  m_InputToForgetWeightsTensor = std::make_unique<arm_compute::CLTensor>();
73  BuildArmComputeTensor(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights->GetTensorInfo());
74 
75  m_InputToCellWeightsTensor = std::make_unique<arm_compute::CLTensor>();
76  BuildArmComputeTensor(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights->GetTensorInfo());
77 
78  m_InputToOutputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
79  BuildArmComputeTensor(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights->GetTensorInfo());
80 
81  m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
82  BuildArmComputeTensor(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights->GetTensorInfo());
83 
84  m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::CLTensor>();
85  BuildArmComputeTensor(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights->GetTensorInfo());
86 
87  m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::CLTensor>();
88  BuildArmComputeTensor(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights->GetTensorInfo());
89 
90  m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
91  BuildArmComputeTensor(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights->GetTensorInfo());
92 
93  m_InputGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
94  BuildArmComputeTensor(*m_InputGateBiasTensor, m_Data.m_InputGateBias->GetTensorInfo());
95 
96  m_ForgetGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
97  BuildArmComputeTensor(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias->GetTensorInfo());
98 
99  m_CellBiasTensor = std::make_unique<arm_compute::CLTensor>();
100  BuildArmComputeTensor(*m_CellBiasTensor, m_Data.m_CellBias->GetTensorInfo());
101 
102  m_OutputGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
103  BuildArmComputeTensor(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias->GetTensorInfo());
104 
105  const arm_compute::ICLTensor& inputTensor = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
106  arm_compute::ICLTensor& cellStateInTensor = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
107  const arm_compute::ICLTensor& outputStateInTensor = static_cast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
108 
109  arm_compute::ICLTensor& cellStateOutTensor = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
110  arm_compute::ICLTensor& outputStateOutTensor = static_cast<IClTensorHandle*>(m_Data.m_Outputs[1])->GetTensor();
111 
112  m_QuantizedLstmLayer.configure(clCompileContext, &inputTensor, m_InputToInputWeightsTensor.get(),
113  m_InputToForgetWeightsTensor.get(),
114  m_InputToCellWeightsTensor.get(), m_InputToOutputWeightsTensor.get(),
115  m_RecurrentToInputWeightsTensor.get(), m_RecurrentToForgetWeightsTensor.get(),
116  m_RecurrentToCellWeightsTensor.get(), m_RecurrentToOutputWeightsTensor.get(),
117  m_InputGateBiasTensor.get(), m_ForgetGateBiasTensor.get(), m_CellBiasTensor.get(),
118  m_OutputGateBiasTensor.get(), &cellStateInTensor, &outputStateInTensor,
119  &cellStateOutTensor, &outputStateOutTensor);
120 
121  InitializeArmComputeClTensorData(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights);
122  InitializeArmComputeClTensorData(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights);
123  InitializeArmComputeClTensorData(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights);
124  InitializeArmComputeClTensorData(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights);
125  InitializeArmComputeClTensorData(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights);
126  InitializeArmComputeClTensorData(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights);
127  InitializeArmComputeClTensorData(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights);
128  InitializeArmComputeClTensorData(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights);
130  InitializeArmComputeClTensorData(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias);
132  InitializeArmComputeClTensorData(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias);
133 
134  m_QuantizedLstmLayer.prepare();
135  FreeUnusedTensors();
136 }
const ConstTensorHandle * m_InputGateBias
const ConstTensorHandle * m_RecurrentToInputWeights
const TensorInfo & GetTensorInfo() const
const ConstTensorHandle * m_InputToForgetWeights
const ConstTensorHandle * m_RecurrentToCellWeights
const ConstTensorHandle * m_ForgetGateBias
const ConstTensorHandle * m_RecurrentToOutputWeights
const ConstTensorHandle * m_OutputGateBias
const ConstTensorHandle * m_RecurrentToForgetWeights
const ConstTensorHandle * m_InputToOutputWeights
std::vector< ITensorHandle * > m_Outputs
const ConstTensorHandle * m_InputToInputWeights
const ConstTensorHandle * m_CellBias
void InitializeArmComputeClTensorData(arm_compute::CLTensor &clTensor, const ConstTensorHandle *handle)
std::vector< ITensorHandle * > m_Inputs
const ConstTensorHandle * m_InputToCellWeights

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 138 of file ClQuantizedLstmWorkload.cpp.

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

139 {
140  ARMNN_SCOPED_PROFILING_EVENT_CL("ClQuantizedLstmWorkload_Execute");
141  RunClFunction(m_QuantizedLstmLayer, CHECK_LOCATION());
142 }
#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: