ArmNN
 21.02
ClQLstmWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClQLstmWorkload.hpp"
7 #include "ClWorkloadUtils.hpp"
8 
10 
11 #include "cl/ClTensorHandle.hpp"
12 
13 namespace armnn
14 {
15 using namespace armcomputetensorutils;
16 
18  const WorkloadInfo& info,
19  const arm_compute::CLCompileContext& clCompileContext)
20  : BaseWorkload<QLstmQueueDescriptor>(descriptor, info)
21 {
22  arm_compute::LSTMParams<arm_compute::ICLTensor> qLstmParams;
23 
24  // Mandatory params
25  m_InputToForgetWeightsTensor = std::make_unique<arm_compute::CLTensor>();
26  BuildArmComputeTensor(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights->GetTensorInfo());
27 
28  m_InputToCellWeightsTensor = std::make_unique<arm_compute::CLTensor>();
29  BuildArmComputeTensor(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights->GetTensorInfo());
30 
31  m_InputToOutputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
32  BuildArmComputeTensor(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights->GetTensorInfo());
33 
34  m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::CLTensor>();
35  BuildArmComputeTensor(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights->GetTensorInfo());
36 
37  m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::CLTensor>();
38  BuildArmComputeTensor(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights->GetTensorInfo());
39 
40  m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
41  BuildArmComputeTensor(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights->GetTensorInfo());
42 
43  m_ForgetGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
44  BuildArmComputeTensor(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias->GetTensorInfo());
45 
46  m_CellBiasTensor = std::make_unique<arm_compute::CLTensor>();
47  BuildArmComputeTensor(*m_CellBiasTensor, m_Data.m_CellBias->GetTensorInfo());
48 
49  m_OutputGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
50  BuildArmComputeTensor(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias->GetTensorInfo());
51 
52  // Create tensors for optional params if they are enabled
54  {
55  m_CellToInputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
56 
58  {
59  // In ACL this is categorised as a CIFG param and not a Peephole param
60  BuildArmComputeTensor(*m_CellToInputWeightsTensor, m_Data.m_CellToInputWeights->GetTensorInfo());
61  }
62 
63  m_CellToForgetWeightsTensor = std::make_unique<arm_compute::CLTensor>();
64  BuildArmComputeTensor(*m_CellToForgetWeightsTensor, m_Data.m_CellToForgetWeights->GetTensorInfo());
65 
66  m_CellToOutputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
67  BuildArmComputeTensor(*m_CellToOutputWeightsTensor, m_Data.m_CellToOutputWeights->GetTensorInfo());
68 
69  // Set Peephole params
70  qLstmParams.set_peephole_params(m_CellToForgetWeightsTensor.get(),
71  m_CellToOutputWeightsTensor.get());
72  }
73 
75  {
76  m_ProjectionWeightsTensor = std::make_unique<arm_compute::CLTensor>();
77  BuildArmComputeTensor(*m_ProjectionWeightsTensor, m_Data.m_ProjectionWeights->GetTensorInfo());
78 
79  m_ProjectionBiasTensor = std::make_unique<arm_compute::CLTensor>();
80  if (m_Data.m_ProjectionBias != nullptr)
81  {
82  BuildArmComputeTensor(*m_ProjectionBiasTensor, m_Data.m_ProjectionBias->GetTensorInfo());
83  }
84 
85  // Set projection params
86  qLstmParams.set_projection_params(
87  m_ProjectionWeightsTensor.get(),
88  m_Data.m_ProjectionBias != nullptr ? m_ProjectionBiasTensor.get() : nullptr);
89  }
90 
92  {
93  m_InputLayerNormWeightsTensor = std::make_unique<arm_compute::CLTensor>();
94 
96  {
97  BuildArmComputeTensor(*m_InputLayerNormWeightsTensor, m_Data.m_InputLayerNormWeights->GetTensorInfo());
98  }
99 
100  m_ForgetLayerNormWeightsTensor = std::make_unique<arm_compute::CLTensor>();
101  BuildArmComputeTensor(*m_ForgetLayerNormWeightsTensor, m_Data.m_ForgetLayerNormWeights->GetTensorInfo());
102 
103  m_CellLayerNormWeightsTensor = std::make_unique<arm_compute::CLTensor>();
104  BuildArmComputeTensor(*m_CellLayerNormWeightsTensor, m_Data.m_CellLayerNormWeights->GetTensorInfo());
105 
106  m_OutputLayerNormWeightsTensor = std::make_unique<arm_compute::CLTensor>();
107  BuildArmComputeTensor(*m_OutputLayerNormWeightsTensor, m_Data.m_OutputLayerNormWeights->GetTensorInfo());
108 
109  // Set layer norm params
110  qLstmParams.set_layer_normalization_params(
111  m_Data.m_InputLayerNormWeights != nullptr ? m_InputLayerNormWeightsTensor.get() : nullptr,
112  m_ForgetLayerNormWeightsTensor.get(),
113  m_CellLayerNormWeightsTensor.get(),
114  m_OutputLayerNormWeightsTensor.get());
115  }
116 
118  {
119  m_InputToInputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
120  BuildArmComputeTensor(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights->GetTensorInfo());
121 
122  m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::CLTensor>();
123  BuildArmComputeTensor(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights->GetTensorInfo());
124 
125  m_InputGateBiasTensor = std::make_unique<arm_compute::CLTensor>();
126  BuildArmComputeTensor(*m_InputGateBiasTensor, m_Data.m_InputGateBias->GetTensorInfo());
127 
128  // Set CIFG params
129  qLstmParams.set_cifg_params(
130  m_InputToInputWeightsTensor.get(),
131  m_RecurrentToInputWeightsTensor.get(),
132  m_Data.m_CellToInputWeights != nullptr ? m_CellToInputWeightsTensor.get() : nullptr,
133  m_InputGateBiasTensor.get());
134  }
135 
136  // Input/Output tensors
137  const arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
138  arm_compute::ICLTensor& outputStateIn = static_cast<IClTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
139  arm_compute::ICLTensor& cellStateIn = static_cast<IClTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
140 
141  arm_compute::ICLTensor& outputStateOut = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
142  arm_compute::ICLTensor& cellStateOut = static_cast<IClTensorHandle*>(m_Data.m_Outputs[1])->GetTensor();
143  arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[2])->GetTensor();
144 
145  // Set scalar descriptor params
146  qLstmParams.set_cell_clip_params(m_Data.m_Parameters.m_CellClip);
147  qLstmParams.set_projection_clip_params(m_Data.m_Parameters.m_ProjectionClip);
148  qLstmParams.set_hidden_state_params(m_Data.m_Parameters.m_HiddenStateZeroPoint,
150  qLstmParams.set_matmul_scale_params(m_Data.m_Parameters.m_InputIntermediateScale,
154 
155  // QLSTM CL configure
156  m_QLstmLayer.configure(clCompileContext,
157  &input,
158  m_InputToForgetWeightsTensor.get(),
159  m_InputToCellWeightsTensor.get(),
160  m_InputToOutputWeightsTensor.get(),
161  m_RecurrentToForgetWeightsTensor.get(),
162  m_RecurrentToCellWeightsTensor.get(),
163  m_RecurrentToOutputWeightsTensor.get(),
164  m_ForgetGateBiasTensor.get(),
165  m_CellBiasTensor.get(),
166  m_OutputGateBiasTensor.get(),
167  &cellStateIn,
168  &outputStateIn,
169  &cellStateOut,
170  &outputStateOut,
171  &output,
172  qLstmParams);
173 
174  // Initialise ACL tensor data for mandatory params
175  InitializeArmComputeClTensorData(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights);
176  InitializeArmComputeClTensorData(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights);
177  InitializeArmComputeClTensorData(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights);
178 
179  InitializeArmComputeClTensorData(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights);
180  InitializeArmComputeClTensorData(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights);
181  InitializeArmComputeClTensorData(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights);
182 
183  InitializeArmComputeClTensorData(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias);
185  InitializeArmComputeClTensorData(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias);
186 
187  // Initialise ACL tensor data for optional params
189  {
190  InitializeArmComputeClTensorData(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights);
191  InitializeArmComputeClTensorData(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights);
193  }
194 
196  {
197  InitializeArmComputeClTensorData(*m_ProjectionWeightsTensor, m_Data.m_ProjectionWeights);
198 
199  if (m_Data.m_ProjectionBias != nullptr)
200  {
201  InitializeArmComputeClTensorData(*m_ProjectionBiasTensor, m_Data.m_ProjectionBias);
202  }
203  }
204 
206  {
208  {
209  InitializeArmComputeClTensorData(*m_CellToInputWeightsTensor, m_Data.m_CellToInputWeights);
210  }
211 
212  InitializeArmComputeClTensorData(*m_CellToForgetWeightsTensor, m_Data.m_CellToForgetWeights);
213  InitializeArmComputeClTensorData(*m_CellToOutputWeightsTensor, m_Data.m_CellToOutputWeights);
214  }
215 
217  {
219  {
220  InitializeArmComputeClTensorData(*m_InputLayerNormWeightsTensor, m_Data.m_InputLayerNormWeights);
221  }
222  InitializeArmComputeClTensorData(*m_ForgetLayerNormWeightsTensor, m_Data.m_ForgetLayerNormWeights);
223  InitializeArmComputeClTensorData(*m_CellLayerNormWeightsTensor, m_Data.m_CellLayerNormWeights);
224  InitializeArmComputeClTensorData(*m_OutputLayerNormWeightsTensor, m_Data.m_OutputLayerNormWeights);
225  }
226 
227  m_QLstmLayer.prepare();
228 
229  FreeUnusedTensors();
230 }
231 
233 {
234  m_QLstmLayer.run();
235 }
236 
238  const TensorInfo& cellStateIn,
239  const TensorInfo& outputStateIn,
240  const TensorInfo& cellStateOut,
241  const TensorInfo& outputStateOut,
242  const TensorInfo& output,
243  const QLstmDescriptor& descriptor,
244  const LstmInputParamsInfo& paramsInfo)
245 {
246  arm_compute::LSTMParams<arm_compute::ITensorInfo> aclParamsInfo;
247 
248  // Input/Output tensor info
249  const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input);
250  const arm_compute::TensorInfo aclOutputStateInInfo = BuildArmComputeTensorInfo(outputStateIn);
251  const arm_compute::TensorInfo aclCellStateInInfo = BuildArmComputeTensorInfo(cellStateIn);
252 
253  const arm_compute::TensorInfo aclOutputStateOutInfo = BuildArmComputeTensorInfo(outputStateOut);
254  const arm_compute::TensorInfo aclCellStateOutInfo = BuildArmComputeTensorInfo(cellStateOut);
255  const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output);
256 
257  // Mandatory tensor info
258  const arm_compute::TensorInfo aclInputToForgetWeightsInfo
259  = BuildArmComputeTensorInfo(paramsInfo.GetInputToForgetWeights());
260  const arm_compute::TensorInfo aclInputToCellWeightsInfo
261  = BuildArmComputeTensorInfo(paramsInfo.GetInputToCellWeights());
262  const arm_compute::TensorInfo aclInputToOutputWeightsInfo
263  = BuildArmComputeTensorInfo(paramsInfo.GetInputToOutputWeights());
264  const arm_compute::TensorInfo aclRecurrentToForgetWeightsInfo
265  = BuildArmComputeTensorInfo(paramsInfo.GetRecurrentToForgetWeights());
266  const arm_compute::TensorInfo aclRecurrentToCellWeightsInfo
267  = BuildArmComputeTensorInfo(paramsInfo.GetRecurrentToCellWeights());
268  const arm_compute::TensorInfo aclRecurrentToOutputWeightsInfo
269  = BuildArmComputeTensorInfo(paramsInfo.GetRecurrentToOutputWeights());
270  const arm_compute::TensorInfo aclForgetGateBiasInfo
271  = BuildArmComputeTensorInfo(paramsInfo.GetForgetGateBias());
272  const arm_compute::TensorInfo aclCellBiasInfo
273  = BuildArmComputeTensorInfo(paramsInfo.GetCellBias());
274  const arm_compute::TensorInfo aclOutputGateBiasInfo
275  = BuildArmComputeTensorInfo(paramsInfo.GetOutputGateBias());
276 
277  // Optional tensor info
278  arm_compute::TensorInfo aclInputToInputWeightsInfo;
279  arm_compute::TensorInfo aclRecurrentToInputWeightsInfo;
280 
281  arm_compute::TensorInfo aclCellToInputWeightsInfo;
282  arm_compute::TensorInfo aclCellToForgetWeightsInfo;
283  arm_compute::TensorInfo aclCellToOutputWeightsInfo;
284 
285  arm_compute::TensorInfo aclInputGateBiasInfo;
286 
287  arm_compute::TensorInfo aclProjectionWeightsInfo;
288  arm_compute::TensorInfo aclProjectionBiasInfo;
289 
290  arm_compute::TensorInfo aclInputLayerNormWeightsInfo;
291  arm_compute::TensorInfo aclForgetLayerNormWeightsInfo;
292  arm_compute::TensorInfo aclCellLayerNormWeightsInfo;
293  arm_compute::TensorInfo aclOutputLayerNormWeightsInfo;
294 
295  // Create tensor info for optional params if they are enabled
296  if (descriptor.m_PeepholeEnabled)
297  {
298  if (!descriptor.m_CifgEnabled)
299  {
300  aclCellToInputWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetCellToInputWeights());
301  }
302 
303  aclCellToForgetWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetCellToForgetWeights());
304  aclCellToOutputWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetCellToOutputWeights());
305 
306  // Set peephole params info
307  aclParamsInfo.set_peephole_params(&aclCellToForgetWeightsInfo,
308  &aclCellToOutputWeightsInfo);
309  }
310 
311  if (descriptor.m_ProjectionEnabled)
312  {
313  aclProjectionWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetProjectionWeights());
314 
315  if (paramsInfo.m_ProjectionBias != nullptr)
316  {
317  aclProjectionBiasInfo = BuildArmComputeTensorInfo(paramsInfo.GetProjectionBias());
318  }
319 
320  // Set projection params info
321  aclParamsInfo.set_projection_params(
322  &aclProjectionWeightsInfo,
323  paramsInfo.m_ProjectionBias != nullptr ? &aclProjectionBiasInfo : nullptr);
324  }
325 
326  if (descriptor.m_LayerNormEnabled)
327  {
328  if (!descriptor.m_CifgEnabled)
329  {
330  aclInputLayerNormWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetInputLayerNormWeights());
331  }
332 
333  aclForgetLayerNormWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetForgetLayerNormWeights());
334  aclCellLayerNormWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetCellLayerNormWeights());
335  aclOutputLayerNormWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetOutputLayerNormWeights());
336 
337  // Set layer norm params info
338  aclParamsInfo.set_layer_normalization_params(
339  paramsInfo.m_InputLayerNormWeights != nullptr ? &aclInputLayerNormWeightsInfo : nullptr,
340  &aclForgetLayerNormWeightsInfo,
341  &aclCellLayerNormWeightsInfo,
342  &aclOutputLayerNormWeightsInfo);
343  }
344 
345  if (!descriptor.m_CifgEnabled)
346  {
347  aclInputToInputWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetInputToInputWeights());
348  aclRecurrentToInputWeightsInfo = BuildArmComputeTensorInfo(paramsInfo.GetRecurrentToInputWeights());
349  aclInputGateBiasInfo = BuildArmComputeTensorInfo(paramsInfo.GetInputGateBias());
350 
351  // Set CIFG params info
352  aclParamsInfo.set_cifg_params(
353  &aclInputToInputWeightsInfo,
354  &aclRecurrentToInputWeightsInfo,
355  paramsInfo.m_CellToInputWeights != nullptr ? &aclCellToInputWeightsInfo : nullptr,
356  &aclInputGateBiasInfo);
357  }
358 
359  // Set scalar descriptor params
360  aclParamsInfo.set_cell_clip_params(descriptor.m_CellClip);
361  aclParamsInfo.set_projection_clip_params(descriptor.m_ProjectionClip);
362  aclParamsInfo.set_hidden_state_params(descriptor.m_HiddenStateZeroPoint, descriptor.m_HiddenStateScale);
363  aclParamsInfo.set_matmul_scale_params(descriptor.m_InputIntermediateScale,
364  descriptor.m_ForgetIntermediateScale,
365  descriptor.m_CellIntermediateScale,
366  descriptor.m_OutputIntermediateScale);
367 
368  // QLSTM CL validate
369  return arm_compute::CLQLSTMLayer::validate(&aclInputInfo,
370  &aclInputToForgetWeightsInfo,
371  &aclInputToCellWeightsInfo,
372  &aclInputToOutputWeightsInfo,
373  &aclRecurrentToForgetWeightsInfo,
374  &aclRecurrentToCellWeightsInfo,
375  &aclRecurrentToOutputWeightsInfo,
376  &aclForgetGateBiasInfo,
377  &aclCellBiasInfo,
378  &aclOutputGateBiasInfo,
379  &aclCellStateInInfo,
380  &aclOutputStateInInfo,
381  &aclCellStateOutInfo,
382  &aclOutputStateOutInfo,
383  &aclOutputInfo,
384  aclParamsInfo);
385 }
386 
387 void ClQLstmWorkload::FreeUnusedTensors()
388 {
389  FreeTensorIfUnused(m_InputToInputWeightsTensor);
390  FreeTensorIfUnused(m_InputToForgetWeightsTensor);
391  FreeTensorIfUnused(m_InputToCellWeightsTensor);
392  FreeTensorIfUnused(m_InputToOutputWeightsTensor);
393 
394  FreeTensorIfUnused(m_RecurrentToInputWeightsTensor);
395  FreeTensorIfUnused(m_RecurrentToForgetWeightsTensor);
396  FreeTensorIfUnused(m_RecurrentToCellWeightsTensor);
397  FreeTensorIfUnused(m_RecurrentToOutputWeightsTensor);
398 
399  FreeTensorIfUnused(m_CellToInputWeightsTensor);
400  FreeTensorIfUnused(m_CellToForgetWeightsTensor);
401  FreeTensorIfUnused(m_CellToOutputWeightsTensor);
402 
403  FreeTensorIfUnused(m_InputGateBiasTensor);
404  FreeTensorIfUnused(m_ForgetGateBiasTensor);
405  FreeTensorIfUnused(m_CellBiasTensor);
406  FreeTensorIfUnused(m_OutputGateBiasTensor);
407 
408  FreeTensorIfUnused(m_ProjectionWeightsTensor);
409  FreeTensorIfUnused(m_ProjectionBiasTensor);
410 
411  FreeTensorIfUnused(m_InputLayerNormWeightsTensor);
412  FreeTensorIfUnused(m_ForgetLayerNormWeightsTensor);
413  FreeTensorIfUnused(m_CellLayerNormWeightsTensor);
414  FreeTensorIfUnused(m_OutputLayerNormWeightsTensor);
415 }
416 
417 } //namespace armnn
const ConstCpuTensorHandle * m_CellToForgetWeights
const TensorInfo * m_InputLayerNormWeights
Definition: LstmParams.hpp:106
const TensorInfo & GetRecurrentToCellWeights() const
Definition: LstmParams.hpp:145
const ConstCpuTensorHandle * m_ProjectionWeights
const TensorInfo & GetCellBias() const
Definition: LstmParams.hpp:173
void InitializeArmComputeClTensorData(arm_compute::CLTensor &clTensor, const ConstCpuTensorHandle *handle)
const TensorInfo & GetRecurrentToInputWeights() const
Definition: LstmParams.hpp:137
const TensorInfo & GetCellLayerNormWeights() const
Definition: LstmParams.hpp:197
const TensorInfo & GetRecurrentToOutputWeights() const
Definition: LstmParams.hpp:149
bool m_PeepholeEnabled
Enable/disable peephole.
const ConstCpuTensorHandle * m_ProjectionBias
virtual void Execute() const override
float m_HiddenStateScale
Hidden State quantization scale.
const ConstCpuTensorHandle * m_ForgetLayerNormWeights
const QLstmQueueDescriptor m_Data
Definition: Workload.hpp:46
float m_OutputIntermediateScale
Output intermediate quantization scale.
const TensorInfo & GetCellToInputWeights() const
Definition: LstmParams.hpp:153
const ConstCpuTensorHandle * m_CellLayerNormWeights
const ConstCpuTensorHandle * m_RecurrentToCellWeights
const ConstCpuTensorHandle * m_RecurrentToInputWeights
const ConstCpuTensorHandle * m_OutputGateBias
const ConstCpuTensorHandle * m_CellBias
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetCellToForgetWeights() const
Definition: LstmParams.hpp:157
const TensorInfo & GetForgetLayerNormWeights() const
Definition: LstmParams.hpp:193
const TensorInfo & GetCellToOutputWeights() const
Definition: LstmParams.hpp:161
const ConstCpuTensorHandle * m_CellToOutputWeights
const TensorInfo & GetInputToCellWeights() const
Definition: LstmParams.hpp:129
const ConstCpuTensorHandle * m_OutputLayerNormWeights
bool m_LayerNormEnabled
Enable/disable layer normalization.
const ConstCpuTensorHandle * m_InputToForgetWeights
const TensorInfo & GetInputToOutputWeights() const
Definition: LstmParams.hpp:133
float m_ProjectionClip
Clipping threshold value for the projection.
float m_InputIntermediateScale
Input intermediate quantization scale.
const TensorInfo * m_ProjectionBias
Definition: LstmParams.hpp:105
Status
enumeration
Definition: Types.hpp:26
A QLstmDescriptor for the QLstmLayer.
const TensorInfo * m_CellToInputWeights
Definition: LstmParams.hpp:97
const TensorInfo & GetRecurrentToForgetWeights() const
Definition: LstmParams.hpp:141
float m_ForgetIntermediateScale
Forget intermediate quantization scale.
const ConstCpuTensorHandle * m_CellToInputWeights
const TensorInfo & GetInputToInputWeights() const
Definition: LstmParams.hpp:121
const TensorInfo & GetOutputLayerNormWeights() const
Definition: LstmParams.hpp:201
float m_CellClip
Clipping threshold value for the cell state.
ClQLstmWorkload(const QLstmQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
const ConstCpuTensorHandle * m_RecurrentToOutputWeights
const TensorInfo & GetForgetGateBias() const
Definition: LstmParams.hpp:169
std::vector< ITensorHandle * > m_Outputs
bool m_ProjectionEnabled
Enable/disable the projection layer.
const ConstCpuTensorHandle * m_InputGateBias
const TensorInfo & GetInputGateBias() const
Definition: LstmParams.hpp:165
const TensorInfo & GetProjectionWeights() const
Definition: LstmParams.hpp:181
const TensorInfo & GetInputToForgetWeights() const
Definition: LstmParams.hpp:125
Contains information about inputs and outputs to a layer.
arm_compute::Status ClQLstmWorkloadValidate(const TensorInfo &input, const TensorInfo &cellStateIn, const TensorInfo &outputStateIn, const TensorInfo &cellStateOut, const TensorInfo &outputStateOut, const TensorInfo &output, const QLstmDescriptor &descriptor, const LstmInputParamsInfo &paramsInfo)
const TensorInfo & GetInputLayerNormWeights() const
Definition: LstmParams.hpp:189
std::vector< ITensorHandle * > m_Inputs
const ConstCpuTensorHandle * m_InputLayerNormWeights
const ConstCpuTensorHandle * m_RecurrentToForgetWeights
const TensorInfo & GetOutputGateBias() const
Definition: LstmParams.hpp:177
const ConstCpuTensorHandle * m_ForgetGateBias
const TensorInfo & GetProjectionBias() const
Definition: LstmParams.hpp:185
float m_CellIntermediateScale
Cell intermediate quantization scale.
const ConstCpuTensorHandle * m_InputToOutputWeights
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
const TensorInfo & GetTensorInfo() const
const ConstCpuTensorHandle * m_InputToInputWeights
int32_t m_HiddenStateZeroPoint
Hidden State zero point.
const ConstCpuTensorHandle * m_InputToCellWeights