ArmNN
 24.02
NeonQLstmWorkload.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/Descriptors.hpp>
9 #include <armnn/LstmParams.hpp>
10 #include "NeonBaseWorkload.hpp"
12 
13 #include "arm_compute/graph/Tensor.h"
14 #include "arm_compute/runtime/NEON/functions/NEQLSTMLayer.h"
15 
16 namespace armnn
17 {
18 
19 class NeonQLstmWorkload : public NeonBaseWorkload<QLstmQueueDescriptor>
20 {
21 public:
22  NeonQLstmWorkload(const QLstmQueueDescriptor& descriptor, const WorkloadInfo& info);
23  virtual void Execute() const override;
24 
25 private:
26  mutable arm_compute::NEQLSTMLayer m_QLstmLayer;
27 
28  std::unique_ptr<arm_compute::Tensor> m_InputToInputWeightsTensor;
29  std::unique_ptr<arm_compute::Tensor> m_InputToForgetWeightsTensor;
30  std::unique_ptr<arm_compute::Tensor> m_InputToCellWeightsTensor;
31  std::unique_ptr<arm_compute::Tensor> m_InputToOutputWeightsTensor;
32 
33  std::unique_ptr<arm_compute::Tensor> m_RecurrentToInputWeightsTensor;
34  std::unique_ptr<arm_compute::Tensor> m_RecurrentToForgetWeightsTensor;
35  std::unique_ptr<arm_compute::Tensor> m_RecurrentToCellWeightsTensor;
36  std::unique_ptr<arm_compute::Tensor> m_RecurrentToOutputWeightsTensor;
37 
38  std::unique_ptr<arm_compute::Tensor> m_CellToInputWeightsTensor;
39  std::unique_ptr<arm_compute::Tensor> m_CellToForgetWeightsTensor;
40  std::unique_ptr<arm_compute::Tensor> m_CellToOutputWeightsTensor;
41 
42  std::unique_ptr<arm_compute::Tensor> m_InputGateBiasTensor;
43  std::unique_ptr<arm_compute::Tensor> m_ForgetGateBiasTensor;
44  std::unique_ptr<arm_compute::Tensor> m_CellBiasTensor;
45  std::unique_ptr<arm_compute::Tensor> m_OutputGateBiasTensor;
46 
47  std::unique_ptr<arm_compute::Tensor> m_ProjectionWeightsTensor;
48  std::unique_ptr<arm_compute::Tensor> m_ProjectionBiasTensor;
49 
50  std::unique_ptr<arm_compute::Tensor> m_InputLayerNormWeightsTensor;
51  std::unique_ptr<arm_compute::Tensor> m_ForgetLayerNormWeightsTensor;
52  std::unique_ptr<arm_compute::Tensor> m_CellLayerNormWeightsTensor;
53  std::unique_ptr<arm_compute::Tensor> m_OutputLayerNormWeightsTensor;
54 
55  void FreeUnusedTensors();
56 };
57 
59  const TensorInfo& cellStateIn,
60  const TensorInfo& outputStateIn,
61  const TensorInfo& cellStateOut,
62  const TensorInfo& outputStateOut,
63  const TensorInfo& output,
64  const QLstmDescriptor& descriptor,
65  const LstmInputParamsInfo& paramsInfo);
66 
67 } //namespace armnn
armnn::QLstmDescriptor
A QLstmDescriptor for the QLstmLayer.
Definition: Descriptors.hpp:1380
Descriptors.hpp
WorkloadData.hpp
armnn::NeonQLstmWorkloadValidate
arm_compute::Status NeonQLstmWorkloadValidate(const TensorInfo &input, const TensorInfo &cellStateIn, const TensorInfo &outputStateIn, const TensorInfo &cellStateOut, const TensorInfo &outputStateOut, const TensorInfo &output, const QLstmDescriptor &descriptor, const LstmInputParamsInfo &paramsInfo)
Definition: NeonQLstmWorkload.cpp:243
armnn::TensorInfo
Definition: Tensor.hpp:152
NeonBaseWorkload.hpp
LstmParams.hpp
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::NeonQLstmWorkload
Definition: NeonQLstmWorkload.hpp:19
armnn::QLstmQueueDescriptor
Definition: WorkloadData.hpp:562
armnn::BoostLogSeverityMapping::info
@ info
armnn::Status
Status
Definition: Types.hpp:42
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::LstmInputParamsInfo
Definition: LstmParams.hpp:63
armnn::NeonQLstmWorkload::NeonQLstmWorkload
NeonQLstmWorkload(const QLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonQLstmWorkload.cpp:17
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::NeonQLstmWorkload::Execute
virtual void Execute() const override
Definition: NeonQLstmWorkload.cpp:237