ArmNN
 24.02
NeonUnidirectionalSequenceLstmWorkload Class Reference

#include <NeonUnidirectionalSequenceLstmWorkload.hpp>

Inheritance diagram for NeonUnidirectionalSequenceLstmWorkload:
[legend]
Collaboration diagram for NeonUnidirectionalSequenceLstmWorkload:
[legend]

Public Member Functions

 NeonUnidirectionalSequenceLstmWorkload (const UnidirectionalSequenceLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual void Execute () const override
 
- Public Member Functions inherited from NeonBaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >
 NeonBaseWorkload (const UnidirectionalSequenceLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
void ReplaceInputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
void ReplaceOutputTensorHandle (ITensorHandle *tensorHandle, unsigned int slot) override
 
- Public Member Functions inherited from BaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >
 BaseWorkload (const UnidirectionalSequenceLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
 
virtual const std::string & GetName () const override
 
void ExecuteAsync (ExecutionData &executionData) override
 
void PostAllocationConfigure () override
 
const UnidirectionalSequenceLstmQueueDescriptorGetData () const
 
arm::pipe::ProfilingGuid GetGuid () const final
 
virtual bool SupportsTensorHandleReplacement () const override
 
- Public Member Functions inherited from IWorkload
virtual ~IWorkload ()
 
virtual arm::pipe::ProfilingGuid GetGuid () const =0
 
virtual bool SupportsTensorHandleReplacement () const =0
 
virtual const std::string & GetName () const =0
 
virtual void RegisterDebugCallback (const DebugCallbackFunction &)
 
virtual armnn::Optional< armnn::MemoryRequirementsGetMemoryRequirements ()
 

Additional Inherited Members

- Protected Member Functions inherited from NeonBaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >
virtual void Reconfigure ()
 
- Protected Attributes inherited from BaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >
UnidirectionalSequenceLstmQueueDescriptor m_Data
 
const arm::pipe::ProfilingGuid m_Guid
 
const std::string m_Name
 

Detailed Description

Definition at line 22 of file NeonUnidirectionalSequenceLstmWorkload.hpp.

Constructor & Destructor Documentation

◆ NeonUnidirectionalSequenceLstmWorkload()

Definition at line 33 of file NeonUnidirectionalSequenceLstmWorkload.cpp.

34  : NeonBaseWorkload<UnidirectionalSequenceLstmQueueDescriptor>(descriptor, info)
35 {
36  // Report Profiling Details
37  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonUnidirectionalSequenceLstmWorkload_Construct",
38  descriptor.m_Parameters,
39  info,
40  GetGuid());
41 
42  // Input/Output tensors
43  const arm_compute::ITensor& input = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
44  arm_compute::ITensor& outputStateIn = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[1])->GetTensor();
45  const arm_compute::ITensor& cellStateIn = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[2])->GetTensor();
46 
47  arm_compute::ITensor& outputStateOut = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
48  arm_compute::ITensor& cellStateOut = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[1])->GetTensor();
49  arm_compute::ITensor& output = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[2])->GetTensor();
50 
51  TensorInfo inputInfo = info.m_InputTensorInfos[0];
52  TensorInfo outputInfo = info.m_OutputTensorInfos[2];
53 
54  TensorShape inputLayerShape = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetShape();
55  TensorShape outputLayerShape = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[2])->GetShape();
56 
57  unsigned int maxTime = m_Data.m_Parameters.m_TimeMajor ? inputLayerShape[0] : inputLayerShape[1];
58  unsigned int batchSize = m_Data.m_Parameters.m_TimeMajor ? inputLayerShape[1] : inputLayerShape[0];
59  unsigned int inputSize = inputLayerShape[2];
60  unsigned int outputSize = outputLayerShape[2];
61 
62  const TensorShape timeMajorShapeInput({maxTime, batchSize, inputSize});
63  const TensorShape timeMajorShapeOutput({maxTime, batchSize, outputSize});
64 
65  //
66  // Permute: performed if Unidirectional Sequence Layer inputs/outputs are in batch major format.
67  //
69  {
70  std::unique_ptr<arm_compute::NEPermute> layer(new arm_compute::NEPermute());
71 
72  TensorInfo permuteOutInfo = inputInfo;
73  permuteOutInfo.SetShape(timeMajorShapeInput);
74  BuildArmComputeTensor(m_PermuteFirstOut, permuteOutInfo);
75  armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_PermuteFirstOut);
76 
77  // Permute to time major format.
78  layer->configure(&input, &m_PermuteFirstOut, arm_compute::PermutationVector(0U,2U,1U));
79  m_Permute1.reset(layer.release());
80  }
81 
82  //
83  // Split and Concat Tensors
84  //
85  for (unsigned int i = 0; i < maxTime; ++i)
86  {
87  arm_compute::Tensor splitter_out;
88  arm_compute::Tensor concat_in;
89 
90  auto splitterTensorInfo = inputInfo;
91  auto concatTensorInfo = outputInfo;
92  splitterTensorInfo.SetShape({batchSize, inputSize});
93  concatTensorInfo.SetShape({batchSize, outputSize});
94  BuildArmComputeTensor(splitter_out, splitterTensorInfo);
95  BuildArmComputeTensor(concat_in, concatTensorInfo);
96 
97  armcomputetensorutils::InitialiseArmComputeTensorEmpty(splitter_out);
98  armcomputetensorutils::InitialiseArmComputeTensorEmpty(concat_in);
99 
100  // append to std::vector<arm_compute::Tensor>
101  m_SplitterOutputsTensors.push_back(std::move(splitter_out));
102  m_ConcatInputsTensors.push_back(std::move(concat_in));
103  }
104 
105  for (unsigned int i = 0; i < maxTime; ++i)
106  {
107  // append to std::vector<arm_compute::ITensor*>
108  m_SplitterOutputs.push_back(&m_SplitterOutputsTensors[i]);
109  m_ConcatInputs.push_back(&m_ConcatInputsTensors[i]);
110  }
111 
112  //
113  // Split
114  //
115  unsigned int numberDimensions = 3;
116  unsigned int dimension = 0; // splitting on 0-dimension (i.e. maxTime dimension)
117 
118  if (maxTime != 1) // ACL split does not work with only one element to split.
119  {
120  ViewsDescriptor splitterDesc(maxTime, numberDimensions);
121  unsigned int splitterDimSizes[3] = {1, batchSize, inputSize};
122  for (unsigned int outputIdx = 0u; outputIdx < maxTime; ++outputIdx)
123  {
124  splitterDesc.SetViewOriginCoord(outputIdx, dimension, splitterDimSizes[dimension] * outputIdx);
125  for (unsigned int dimIdx = 0u; dimIdx < numberDimensions; ++dimIdx)
126  {
127  splitterDesc.SetViewSize(outputIdx, dimIdx, splitterDimSizes[dimIdx]);
128  }
129  }
130 
131  std::set<unsigned int> splitAxis = ComputeSplitAxis(splitterDesc, timeMajorShapeInput);
132 
133  std::unique_ptr<arm_compute::NESplit> split_layer(new arm_compute::NESplit());
134  unsigned int aclAxisSplit = CalcAclAxis(splitterDesc.GetNumDimensions(),
135  *splitAxis.begin());
137  {
138  split_layer->configure(&m_PermuteFirstOut, m_SplitterOutputs, aclAxisSplit);
139  } else
140  {
141  split_layer->configure(&input, m_SplitterOutputs, aclAxisSplit);
142  }
143 
144  split_layer->prepare();
145  m_Splitter.reset(split_layer.release());
146  }
147 
148  //
149  // Lstm
150  //
151  arm_compute::LSTMParams<arm_compute::ITensor> lstm_param;
152 
153  lstm_param.set_cell_clip_params(descriptor.m_Parameters.m_ClippingThresCell);
154  lstm_param.set_projection_clip_params(descriptor.m_Parameters.m_ClippingThresProj);
155 
156  lstm_param.set_matmul_scale_params(descriptor.m_Parameters.m_InputIntermediateScale,
157  descriptor.m_Parameters.m_ForgetIntermediateScale,
158  descriptor.m_Parameters.m_CellIntermediateScale,
159  descriptor.m_Parameters.m_OutputIntermediateScale);
160 
161  lstm_param.set_hidden_state_params(descriptor.m_Parameters.m_HiddenStateZeroPoint,
162  descriptor.m_Parameters.m_HiddenStateScale);
163 
164  m_InputToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
165  BuildArmComputeTensor(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights->GetTensorInfo());
166 
167  m_InputToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
168  BuildArmComputeTensor(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights->GetTensorInfo());
169 
170  m_InputToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
171  BuildArmComputeTensor(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights->GetTensorInfo());
172 
173  m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
174  BuildArmComputeTensor(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights->GetTensorInfo());
175 
176  m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
177  BuildArmComputeTensor(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights->GetTensorInfo());
178 
179  m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
180  BuildArmComputeTensor(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights->GetTensorInfo());
181 
182  m_ForgetGateBiasTensor = std::make_unique<arm_compute::Tensor>();
183  BuildArmComputeTensor(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias->GetTensorInfo());
184 
185  m_CellBiasTensor = std::make_unique<arm_compute::Tensor>();
186  BuildArmComputeTensor(*m_CellBiasTensor, m_Data.m_CellBias->GetTensorInfo());
187 
188  m_OutputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
189  BuildArmComputeTensor(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias->GetTensorInfo());
190 
191  // for future reference: check the AndroidNN API for the logic here
193  {
194  m_InputToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
195  BuildArmComputeTensor(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights->GetTensorInfo());
196 
197  m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
198  BuildArmComputeTensor(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights->GetTensorInfo());
199 
200  m_CellToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
201  if (m_Data.m_CellToInputWeights != nullptr)
202  {
203  BuildArmComputeTensor(*m_CellToInputWeightsTensor, m_Data.m_CellToInputWeights->GetTensorInfo());
204  }
205 
206  m_InputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
207  BuildArmComputeTensor(*m_InputGateBiasTensor, m_Data.m_InputGateBias->GetTensorInfo());
208  lstm_param.set_cifg_params(m_InputToInputWeightsTensor.get(),
209  m_RecurrentToInputWeightsTensor.get(),
210  m_Data.m_CellToInputWeights ? m_CellToInputWeightsTensor.get() : nullptr,
211  m_InputGateBiasTensor.get());
212  }
213 
215  {
216  m_ProjectionWeightsTensor = std::make_unique<arm_compute::Tensor>();
217  BuildArmComputeTensor(*m_ProjectionWeightsTensor, m_Data.m_ProjectionWeights->GetTensorInfo());
218 
219  m_ProjectionBiasTensor = std::make_unique<arm_compute::Tensor>();
220  if (m_Data.m_ProjectionBias != nullptr)
221  {
222  BuildArmComputeTensor(*m_ProjectionBiasTensor, m_Data.m_ProjectionBias->GetTensorInfo());
223  }
224 
225  lstm_param.set_projection_params(m_ProjectionWeightsTensor.get(),
226  m_Data.m_ProjectionBias ? m_ProjectionBiasTensor.get() : nullptr);
227  }
228 
230  {
231  m_CellToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
232  BuildArmComputeTensor(*m_CellToForgetWeightsTensor, m_Data.m_CellToForgetWeights->GetTensorInfo());
233 
234  m_CellToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
235  BuildArmComputeTensor(*m_CellToOutputWeightsTensor, m_Data.m_CellToOutputWeights->GetTensorInfo());
236 
237  lstm_param.set_peephole_params(m_CellToForgetWeightsTensor.get(), m_CellToOutputWeightsTensor.get());
238  }
239 
241  {
242  m_InputLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
244  {
245  BuildArmComputeTensor(*m_InputLayerNormWeightsTensor, m_Data.m_InputLayerNormWeights->GetTensorInfo());
246  }
247 
248  m_ForgetLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
249  BuildArmComputeTensor(*m_ForgetLayerNormWeightsTensor, m_Data.m_ForgetLayerNormWeights->GetTensorInfo());
250 
251  m_CellLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
252  BuildArmComputeTensor(*m_CellLayerNormWeightsTensor, m_Data.m_CellLayerNormWeights->GetTensorInfo());
253 
254  m_OutputLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
255  BuildArmComputeTensor(*m_OutputLayerNormWeightsTensor, m_Data.m_OutputLayerNormWeights->GetTensorInfo());
256 
257  auto inputNormWeightTensor = m_Data.m_Parameters.m_CifgEnabled ? nullptr : m_InputLayerNormWeightsTensor.get();
258  lstm_param.set_layer_normalization_params(inputNormWeightTensor,
259  m_ForgetLayerNormWeightsTensor.get(),
260  m_CellLayerNormWeightsTensor.get(),
261  m_OutputLayerNormWeightsTensor.get());
262  }
263 
264  for (unsigned int i = 0; i != maxTime; ++i)
265  {
266  // Set LSTM input and output ITensors depending on:
267  // input format (timeMajor) & number of LSTM batches (maxTime).
268  arm_compute::ITensor* outputLSTM;
269  arm_compute::ITensor* inputLSTM;
270 
271  // If there is only one LSTM time major batch, we will not concat OR permute.
272  // Set input of LSTM to be first input ITensor.
273  // Set output of LSTM to be final output ITensor.
274  // LSTM input/output cannot be > 2 dimensions so need to resize its TensorInfo.
275  if (maxTime == 1 && m_Data.m_Parameters.m_TimeMajor)
276  {
277  TensorShape inputShape = GetTensorShape(input.info()->tensor_shape(), 1U);
278  TensorShape outputShape = GetTensorShape(output.info()->tensor_shape(), 1U);
279 
280  TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
281  TensorShape outputShapeShrink({outputShape[1], outputShape[2]});
282 
283  auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
284  auto acl_output_shape_shrink = BuildArmComputeTensorShape(outputShapeShrink);
285 
286  input.info()->set_tensor_shape(acl_input_shape_shrink);
287  inputLSTM = const_cast<arm_compute::ITensor*>(&input);
288 
289  output.info()->set_tensor_shape(acl_output_shape_shrink);
290  outputLSTM = &output;
291  }
292  // If there is only one LSTM batch major batch, we will not concat, only permute.
293  // Set input of LSTM to be output of initial permute.
294  // Set output of LSTM to be first element of m_ConcatInputs & use that value later in permute.
295  // LSTM output cannot be > 2 dimensions so need to resize its TensorInfo.
296  else if (maxTime == 1 && !m_Data.m_Parameters.m_TimeMajor)
297  {
298  TensorShape inputShape = GetTensorShape(m_PermuteFirstOut.info()->tensor_shape(), 1U);
299  TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
300  auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
301  m_PermuteFirstOut.info()->set_tensor_shape(acl_input_shape_shrink);
302  inputLSTM = &m_PermuteFirstOut;
303 
304  outputLSTM = const_cast<arm_compute::ITensor*>(m_ConcatInputs[i]);
305  }
306  // Batch major AND/OR 2+ LSTM batches so will use concat AND/OR permute later on.
307  else
308  {
309  inputLSTM = m_SplitterOutputs[i];
310  outputLSTM = const_cast<arm_compute::ITensor*>(m_ConcatInputs[i]);
311  }
312 
313  std::unique_ptr<arm_compute::NEQLSTMLayer> lstm_layer(new arm_compute::NEQLSTMLayer());
314 
315  lstm_layer->configure(inputLSTM,
316  m_InputToForgetWeightsTensor.get(),
317  m_InputToCellWeightsTensor.get(),
318  m_InputToOutputWeightsTensor.get(),
319  m_RecurrentToForgetWeightsTensor.get(),
320  m_RecurrentToCellWeightsTensor.get(),
321  m_RecurrentToOutputWeightsTensor.get(),
322  m_ForgetGateBiasTensor.get(),
323  m_CellBiasTensor.get(),
324  m_OutputGateBiasTensor.get(),
325  &cellStateIn,
326  &outputStateIn,
327  &cellStateOut,
328  &outputStateOut,
329  outputLSTM,
330  lstm_param);
331 
332  m_Layers.emplace_back(std::move(lstm_layer));
333  }
334 
335  InitializeArmComputeTensorData(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights);
336  InitializeArmComputeTensorData(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights);
337  InitializeArmComputeTensorData(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights);
338  InitializeArmComputeTensorData(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights);
339  InitializeArmComputeTensorData(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights);
340  InitializeArmComputeTensorData(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights);
341  InitializeArmComputeTensorData(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias);
343  InitializeArmComputeTensorData(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias);
344 
346  {
347  InitializeArmComputeTensorData(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights);
348  InitializeArmComputeTensorData(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights);
349  if (m_Data.m_CellToInputWeights != nullptr)
350  {
351  InitializeArmComputeTensorData(*m_CellToInputWeightsTensor, m_Data.m_CellToInputWeights);
352  }
353  InitializeArmComputeTensorData(*m_InputGateBiasTensor, m_Data.m_InputGateBias);
354  }
355 
357  {
358  InitializeArmComputeTensorData(*m_ProjectionWeightsTensor, m_Data.m_ProjectionWeights);
359  if (m_Data.m_ProjectionBias != nullptr)
360  {
361  InitializeArmComputeTensorData(*m_ProjectionBiasTensor, m_Data.m_ProjectionBias);
362  }
363  }
364 
366  {
367  InitializeArmComputeTensorData(*m_CellToForgetWeightsTensor, m_Data.m_CellToForgetWeights);
368  InitializeArmComputeTensorData(*m_CellToOutputWeightsTensor, m_Data.m_CellToOutputWeights);
369  }
370 
372  {
374  {
375  InitializeArmComputeTensorData(*m_InputLayerNormWeightsTensor, m_Data.m_InputLayerNormWeights);
376  }
377  InitializeArmComputeTensorData(*m_ForgetLayerNormWeightsTensor, m_Data.m_ForgetLayerNormWeights);
378  InitializeArmComputeTensorData(*m_CellLayerNormWeightsTensor, m_Data.m_CellLayerNormWeights);
379  InitializeArmComputeTensorData(*m_OutputLayerNormWeightsTensor, m_Data.m_OutputLayerNormWeights);
380  }
381 
382  // Force Compute Library to perform the necessary copying and reshaping.
383  // After which delete all the input tensors that will no longer be needed.
384  for (uint32_t i = 0; i < m_Layers.size(); ++i)
385  {
386  m_Layers[i]->prepare();
387  }
388 
389  //
390  // Concat
391  //
392 
393  // Expand dimensions of LSTM outputs adding one empty dimension to fit concatenate inputs.
394  TensorShape shape = GetTensorShape(m_ConcatInputs[0]->info()->tensor_shape(), 1U);
395  TensorShape shapeExpandTimeMajor({1, shape[0], shape[1]});
396  TensorShape shapeExpandBatchMajor({shape[0], 1, shape[1]});
397 
398  if (maxTime != 1) // ACL concat does not work with only one element to concatenate.
399  {
400  for (unsigned int i = 0; i < maxTime; ++i)
401  {
402  m_ConcatInputs[i]->info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandTimeMajor));
403  }
404  ConcatDescriptor concatDescriptor(maxTime, numberDimensions); // maxTime = num inputs (aka. number of views).
405 
406  for (unsigned int inputIdx = 0u; inputIdx < maxTime; ++inputIdx)
407  {
408  concatDescriptor.SetViewOriginCoord(inputIdx, dimension, inputIdx);
409  concatDescriptor.SetConcatAxis(dimension);
410  }
411  m_Concat.reset(new arm_compute::NEConcatenateLayer());
412 
413  unsigned int aclAxisConcat = CalcAclAxis(concatDescriptor.GetNumDimensions(), concatDescriptor.GetConcatAxis());
415  {
416  TensorInfo concatOutputTensorInfo = outputInfo;
417  concatOutputTensorInfo.SetShape(timeMajorShapeOutput);
418  BuildArmComputeTensor(concat_out, concatOutputTensorInfo);
419  armcomputetensorutils::InitialiseArmComputeTensorEmpty(concat_out);
420 
421  m_Concat->configure(m_ConcatInputs, &concat_out, aclAxisConcat);
422  }
423  else
424  {
425  m_Concat->configure(m_ConcatInputs, &output, aclAxisConcat);
426  }
427 
428  m_Concat->prepare();
429  }
430  // If only one LSTM batch, we do not concat and/or permute.
431  // Must ensure final output info is expanded to correct batch major dimensions.
432  else
433  {
435  {
436  output.info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandBatchMajor));
437  }
438  else
439  {
440  output.info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandTimeMajor));
441  }
442  }
443 
444  //
445  // Permute: only done if input/output are in batch major format.
446  //
448  {
449  // Output now time major. Permute output back to batch major.
450  std::unique_ptr<arm_compute::NEPermute> layer(new arm_compute::NEPermute());
451  if (maxTime != 1)
452  {
453  layer->configure(&concat_out, &output, arm_compute::PermutationVector(0U, 2U, 1U));
454  }
455  else
456  {
457  layer->configure(m_ConcatInputs[0], &output, arm_compute::PermutationVector(0U, 2U, 1U));
458  }
459  m_Permute2.reset(layer.release());
460  }
461 
462  FreeUnusedTensors();
463 }

References ARMNN_REPORT_PROFILING_WORKLOAD_DESC, armnn::info, and QueueDescriptorWithParameters< LayerDescriptor >::m_Parameters.

Member Function Documentation

◆ Execute()

void Execute ( ) const
overridevirtual

Implements IWorkload.

Definition at line 465 of file NeonUnidirectionalSequenceLstmWorkload.cpp.

466 {
467  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonUnidirectionalSequenceLstmWorkload_Execute");
468  if (m_Permute1)
469  {
470  m_Permute1->run();
471  }
472  if (m_Splitter)
473  {
474  m_Splitter->run();
475  }
476  for (uint32_t i = 0; i < m_Layers.size(); ++i)
477  {
478  m_Layers[i]->run();
479  }
480  if (m_Concat)
481  {
482  m_Concat->run();
483  }
484  if (m_Permute2)
485  {
486  m_Permute2->run();
487  }
488 }

References ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID.


The documentation for this class was generated from the following files:
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_CellBias
const ConstTensorHandle * m_CellBias
Definition: WorkloadData.hpp:736
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_RecurrentToCellWeights
const ConstTensorHandle * m_RecurrentToCellWeights
Definition: WorkloadData.hpp:729
armnn::LstmDescriptor::m_TimeMajor
bool m_TimeMajor
Enable/disable time major.
Definition: Descriptors.hpp:1154
armnn::ConcatDescriptor
OriginsDescriptor ConcatDescriptor
Definition: DescriptorsFwd.hpp:59
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputLayerNormWeights
const ConstTensorHandle * m_InputLayerNormWeights
Definition: WorkloadData.hpp:740
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputToOutputWeights
const ConstTensorHandle * m_InputToOutputWeights
Definition: WorkloadData.hpp:726
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_OutputLayerNormWeights
const ConstTensorHandle * m_OutputLayerNormWeights
Definition: WorkloadData.hpp:743
armnn::ConstTensorHandle::GetTensorInfo
const TensorInfo & GetTensorInfo() const
Definition: TensorHandle.hpp:40
armnn::ComputeSplitAxis
std::set< unsigned int > ComputeSplitAxis(const armnn::SplitterDescriptor &desc, const TensorShape &input)
Definition: ArmComputeUtils.hpp:246
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_OutputGateBias
const ConstTensorHandle * m_OutputGateBias
Definition: WorkloadData.hpp:737
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_ForgetLayerNormWeights
const ConstTensorHandle * m_ForgetLayerNormWeights
Definition: WorkloadData.hpp:741
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputToForgetWeights
const ConstTensorHandle * m_InputToForgetWeights
Definition: WorkloadData.hpp:724
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_RecurrentToOutputWeights
const ConstTensorHandle * m_RecurrentToOutputWeights
Definition: WorkloadData.hpp:730
armnn::InitializeArmComputeTensorData
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, TensorInfo tensorInfo, const ITensorHandle *handle)
Definition: NeonWorkloadUtils.hpp:68
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_ProjectionWeights
const ConstTensorHandle * m_ProjectionWeights
Definition: WorkloadData.hpp:738
armnn::LstmDescriptor::m_PeepholeEnabled
bool m_PeepholeEnabled
Enable/disable peephole.
Definition: Descriptors.hpp:1148
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_ForgetGateBias
const ConstTensorHandle * m_ForgetGateBias
Definition: WorkloadData.hpp:735
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputGateBias
const ConstTensorHandle * m_InputGateBias
Definition: WorkloadData.hpp:734
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_CellToInputWeights
const ConstTensorHandle * m_CellToInputWeights
Definition: WorkloadData.hpp:731
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_CellToOutputWeights
const ConstTensorHandle * m_CellToOutputWeights
Definition: WorkloadData.hpp:733
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_RecurrentToForgetWeights
const ConstTensorHandle * m_RecurrentToForgetWeights
Definition: WorkloadData.hpp:728
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_CellToForgetWeights
const ConstTensorHandle * m_CellToForgetWeights
Definition: WorkloadData.hpp:732
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_RecurrentToInputWeights
const ConstTensorHandle * m_RecurrentToInputWeights
Definition: WorkloadData.hpp:727
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputToInputWeights
const ConstTensorHandle * m_InputToInputWeights
Definition: WorkloadData.hpp:723
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::BaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >::GetGuid
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:67
armnn::LstmDescriptor::m_CifgEnabled
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
Definition: Descriptors.hpp:1146
armnn::BaseWorkload< UnidirectionalSequenceLstmQueueDescriptor >::m_Data
UnidirectionalSequenceLstmQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::LstmDescriptor::m_LayerNormEnabled
bool m_LayerNormEnabled
Enable/disable layer normalization.
Definition: Descriptors.hpp:1152
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_ProjectionBias
const ConstTensorHandle * m_ProjectionBias
Definition: WorkloadData.hpp:739
armnn::LstmDescriptor::m_ProjectionEnabled
bool m_ProjectionEnabled
Enable/disable the projection layer.
Definition: Descriptors.hpp:1150
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_InputToCellWeights
const ConstTensorHandle * m_InputToCellWeights
Definition: WorkloadData.hpp:725
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:32
armnnUtils::GetTensorShape
armnn::TensorShape GetTensorShape(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout)
Definition: TensorUtils.cpp:21
armnn::UnidirectionalSequenceLstmQueueDescriptor::m_CellLayerNormWeights
const ConstTensorHandle * m_CellLayerNormWeights
Definition: WorkloadData.hpp:742
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26