15 using namespace armcomputetensorutils;
22 m_InputToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
25 m_InputToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
28 m_InputToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
31 m_InputToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
34 m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
37 m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
40 m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
43 m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
46 m_InputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
49 m_ForgetGateBiasTensor = std::make_unique<arm_compute::Tensor>();
52 m_CellBiasTensor = std::make_unique<arm_compute::Tensor>();
55 m_OutputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
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(),
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);