James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <armnn/TypesUtils.hpp> |
| 9 | |
| 10 | #include <backendsCommon/Workload.hpp> |
| 11 | #include <backendsCommon/WorkloadData.hpp> |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | class RefQLstmWorkload : public BaseWorkload<QLstmQueueDescriptor> |
| 17 | { |
| 18 | public: |
| 19 | explicit RefQLstmWorkload(const QLstmQueueDescriptor& descriptor, const WorkloadInfo& info); |
| 20 | |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 21 | void Execute() const override; |
| 22 | void ExecuteAsync(WorkingMemDescriptor& workingMemDescriptor) override; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 23 | |
| 24 | private: |
Finn Williams | b8181f7 | 2021-04-07 10:23:21 +0100 | [diff] [blame] | 25 | void Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const; |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 26 | std::unique_ptr<ScopedTensorHandle> m_InputToInputWeightsTensor; |
| 27 | std::unique_ptr<ScopedTensorHandle> m_InputToForgetWeightsTensor; |
| 28 | std::unique_ptr<ScopedTensorHandle> m_InputToCellWeightsTensor; |
| 29 | std::unique_ptr<ScopedTensorHandle> m_InputToOutputWeightsTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 30 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 31 | std::unique_ptr<ScopedTensorHandle> m_RecurrentToInputWeightsTensor; |
| 32 | std::unique_ptr<ScopedTensorHandle> m_RecurrentToForgetWeightsTensor; |
| 33 | std::unique_ptr<ScopedTensorHandle> m_RecurrentToCellWeightsTensor; |
| 34 | std::unique_ptr<ScopedTensorHandle> m_RecurrentToOutputWeightsTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 35 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 36 | std::unique_ptr<ScopedTensorHandle> m_CellToInputWeightsTensor; |
| 37 | std::unique_ptr<ScopedTensorHandle> m_CellToForgetWeightsTensor; |
| 38 | std::unique_ptr<ScopedTensorHandle> m_CellToOutputWeightsTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 39 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 40 | std::unique_ptr<ScopedTensorHandle> m_InputGateBiasTensor; |
| 41 | std::unique_ptr<ScopedTensorHandle> m_ForgetGateBiasTensor; |
| 42 | std::unique_ptr<ScopedTensorHandle> m_CellBiasTensor; |
| 43 | std::unique_ptr<ScopedTensorHandle> m_OutputGateBiasTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 44 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 45 | std::unique_ptr<ScopedTensorHandle> m_ProjectionWeightsTensor; |
| 46 | std::unique_ptr<ScopedTensorHandle> m_ProjectionBiasTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 47 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 48 | std::unique_ptr<ScopedTensorHandle> m_InputLayerNormWeightsTensor; |
| 49 | std::unique_ptr<ScopedTensorHandle> m_ForgetLayerNormWeightsTensor; |
| 50 | std::unique_ptr<ScopedTensorHandle> m_CellLayerNormWeightsTensor; |
| 51 | std::unique_ptr<ScopedTensorHandle> m_OutputLayerNormWeightsTensor; |
James Conroy | 4f1f899 | 2020-04-29 20:01:10 +0100 | [diff] [blame] | 52 | |
| 53 | float m_LayerNormEpsilon = static_cast<float>(1e-8); |
| 54 | }; |
| 55 | |
| 56 | } //namespace armnn |