ArmNN
 22.05.01
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
NeonQLstmWorkload(const QLstmQueueDescriptor &descriptor, const WorkloadInfo &info)
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)
Copyright (c) 2021 ARM Limited and Contributors.
virtual void Execute() const override
Status
enumeration
Definition: Types.hpp:42
A QLstmDescriptor for the QLstmLayer.
Contains information about TensorInfos of a layer.