ArmNN
 20.02
ClQuantizedLstmWorkload Class Reference

#include <ClQuantizedLstmWorkload.hpp>

Inheritance diagram for ClQuantizedLstmWorkload:
BaseWorkload< QuantizedLstmQueueDescriptor > IWorkload

Public Member Functions

 ClQuantizedLstmWorkload (const QuantizedLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void Execute () const override
 
- Public Member Functions inherited from BaseWorkload< QuantizedLstmQueueDescriptor >
 BaseWorkload (const QuantizedLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
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 >
const 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 
)

Definition at line 64 of file ClQuantizedLstmWorkload.cpp.

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

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 136 of file ClQuantizedLstmWorkload.cpp.

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

137 {
138  ARMNN_SCOPED_PROFILING_EVENT_CL("ClQuantizedLstmWorkload_Execute");
139  RunClFunction(m_QuantizedLstmLayer, CHECK_LOCATION());
140 }
#define ARMNN_SCOPED_PROFILING_EVENT_CL(name)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
#define CHECK_LOCATION()
Definition: Exceptions.hpp:192

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