15 using namespace armcomputetensorutils;
22 m_InputToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
23 BuildArmComputeTensor(*m_InputToInputWeightsTensor,
m_Data.m_InputToInputWeights->GetTensorInfo());
25 m_InputToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
26 BuildArmComputeTensor(*m_InputToForgetWeightsTensor,
m_Data.m_InputToForgetWeights->GetTensorInfo());
28 m_InputToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
29 BuildArmComputeTensor(*m_InputToCellWeightsTensor,
m_Data.m_InputToCellWeights->GetTensorInfo());
31 m_InputToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
32 BuildArmComputeTensor(*m_InputToOutputWeightsTensor,
m_Data.m_InputToOutputWeights->GetTensorInfo());
34 m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
35 BuildArmComputeTensor(*m_RecurrentToInputWeightsTensor,
m_Data.m_RecurrentToInputWeights->GetTensorInfo());
37 m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
38 BuildArmComputeTensor(*m_RecurrentToForgetWeightsTensor,
m_Data.m_RecurrentToForgetWeights->GetTensorInfo());
40 m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
41 BuildArmComputeTensor(*m_RecurrentToCellWeightsTensor,
m_Data.m_RecurrentToCellWeights->GetTensorInfo());
43 m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
44 BuildArmComputeTensor(*m_RecurrentToOutputWeightsTensor,
m_Data.m_RecurrentToOutputWeights->GetTensorInfo());
46 m_InputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
47 BuildArmComputeTensor(*m_InputGateBiasTensor,
m_Data.m_InputGateBias->GetTensorInfo());
49 m_ForgetGateBiasTensor = std::make_unique<arm_compute::Tensor>();
50 BuildArmComputeTensor(*m_ForgetGateBiasTensor,
m_Data.m_ForgetGateBias->GetTensorInfo());
52 m_CellBiasTensor = std::make_unique<arm_compute::Tensor>();
53 BuildArmComputeTensor(*m_CellBiasTensor,
m_Data.m_CellBias->GetTensorInfo());
55 m_OutputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
56 BuildArmComputeTensor(*m_OutputGateBiasTensor,
m_Data.m_OutputGateBias->GetTensorInfo());
65 m_QuantizedLstmLayer.configure(&input,
66 m_InputToInputWeightsTensor.get(),
67 m_InputToForgetWeightsTensor.get(),
68 m_InputToCellWeightsTensor.get(),
69 m_InputToOutputWeightsTensor.get(),
70 m_RecurrentToInputWeightsTensor.get(),
71 m_RecurrentToForgetWeightsTensor.get(),
72 m_RecurrentToCellWeightsTensor.get(),
73 m_RecurrentToOutputWeightsTensor.get(),
74 m_InputGateBiasTensor.get(),
75 m_ForgetGateBiasTensor.get(),
76 m_CellBiasTensor.get(),
77 m_OutputGateBiasTensor.get(),
84 m_Data.m_InputToInputWeights);
87 m_Data.m_InputToForgetWeights);
90 m_Data.m_InputToCellWeights);
93 m_Data.m_InputToOutputWeights);
96 m_Data.m_RecurrentToInputWeights);
99 m_Data.m_RecurrentToForgetWeights);
102 m_Data.m_RecurrentToCellWeights);
105 m_Data.m_RecurrentToOutputWeights);
121 m_QuantizedLstmLayer.prepare();
128 m_QuantizedLstmLayer.run();
139 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input);
140 const arm_compute::TensorInfo aclCellStateInInfo = BuildArmComputeTensorInfo(cellStateIn);
141 const arm_compute::TensorInfo aclOutputStateInInfo = BuildArmComputeTensorInfo(outputStateIn);
142 const arm_compute::TensorInfo aclCellStateOutInfo = BuildArmComputeTensorInfo(cellStateOut);
143 const arm_compute::TensorInfo aclOutputStateOutInfo = BuildArmComputeTensorInfo(outputStateOut);
146 const arm_compute::TensorInfo aclInputToInputWeightsInfo
148 const arm_compute::TensorInfo aclInputToForgetWeightsInfo
150 const arm_compute::TensorInfo aclInputToCellWeightsInfo
152 const arm_compute::TensorInfo aclInputToOutputWeightsInfo
155 const arm_compute::TensorInfo aclRecurrentToInputWeightsInfo
157 const arm_compute::TensorInfo aclRecurrentToForgetWeightsInfo
159 const arm_compute::TensorInfo aclRecurrentToCellWeightsInfo
161 const arm_compute::TensorInfo aclRecurrentToOutputWeightsInfo
164 const arm_compute::TensorInfo aclInputGateBiasInfo
166 const arm_compute::TensorInfo aclForgetGateBiasInfo
168 const arm_compute::TensorInfo aclCellBiasInfo
169 = BuildArmComputeTensorInfo(paramsInfo.
GetCellBias());
170 const arm_compute::TensorInfo aclOutputGateBiasInfo
173 return arm_compute::NELSTMLayerQuantized::validate(&aclInputInfo,
174 &aclInputToInputWeightsInfo,
175 &aclInputToForgetWeightsInfo,
176 &aclInputToCellWeightsInfo,
177 &aclInputToOutputWeightsInfo,
178 &aclRecurrentToInputWeightsInfo,
179 &aclRecurrentToForgetWeightsInfo,
180 &aclRecurrentToCellWeightsInfo,
181 &aclRecurrentToOutputWeightsInfo,
182 &aclInputGateBiasInfo,
183 &aclForgetGateBiasInfo,
185 &aclOutputGateBiasInfo,
187 &aclOutputStateInInfo,
188 &aclCellStateOutInfo,
189 &aclOutputStateOutInfo);
192 void NeonQuantizedLstmWorkload::FreeUnusedTensors()
194 FreeTensorIfUnused(m_InputToInputWeightsTensor);
195 FreeTensorIfUnused(m_InputToForgetWeightsTensor);
196 FreeTensorIfUnused(m_InputToCellWeightsTensor);
197 FreeTensorIfUnused(m_InputToOutputWeightsTensor);
198 FreeTensorIfUnused(m_RecurrentToInputWeightsTensor);
199 FreeTensorIfUnused(m_RecurrentToForgetWeightsTensor);
200 FreeTensorIfUnused(m_RecurrentToCellWeightsTensor);
201 FreeTensorIfUnused(m_RecurrentToOutputWeightsTensor);
202 FreeTensorIfUnused(m_InputGateBiasTensor);
203 FreeTensorIfUnused(m_ForgetGateBiasTensor);
204 FreeTensorIfUnused(m_CellBiasTensor);
205 FreeTensorIfUnused(m_OutputGateBiasTensor);
206 FreeTensorIfUnused(m_CellStateInTensor);
207 FreeTensorIfUnused(m_OutputStateInTensor);
208 FreeTensorIfUnused(m_CellStateOutTensor);
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
NeonQuantizedLstmWorkload(const QuantizedLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
virtual void Execute() const override
Copyright (c) 2021 ARM Limited and Contributors.
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, TensorInfo tensorInfo, const ITensorHandle *handle)
arm_compute::Status NeonQuantizedLstmWorkloadValidate(const TensorInfo &input, const TensorInfo &cellStateIn, const TensorInfo &outputStateIn, const TensorInfo &cellStateOut, const TensorInfo &outputStateOut, const QuantizedLstmInputParamsInfo ¶msInfo)
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
Contains information about TensorInfos of a layer.