Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <backendsCommon/Workload.hpp> |
| 9 | #include <backendsCommon/WorkloadData.hpp> |
| 10 | |
| 11 | #include <arm_compute/graph/Tensor.h> |
| 12 | #include <arm_compute/runtime/NEON/functions/NELSTMLayerQuantized.h> |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | |
| 17 | class NeonQuantizedLstmWorkload : public BaseWorkload<QuantizedLstmQueueDescriptor> |
| 18 | { |
| 19 | public: |
Francis Murtagh | b3fc252 | 2019-08-09 13:20:50 +0100 | [diff] [blame] | 20 | using BaseWorkload<QuantizedLstmQueueDescriptor>::m_Data; |
Francis Murtagh | 4fc3c48 | 2019-08-02 13:20:54 +0100 | [diff] [blame] | 21 | NeonQuantizedLstmWorkload(const QuantizedLstmQueueDescriptor& descriptor, const WorkloadInfo& info); |
| 22 | virtual void Execute() const override; |
| 23 | |
| 24 | private: |
| 25 | mutable arm_compute::NELSTMLayerQuantized m_QuantizedLstmLayer; |
| 26 | |
| 27 | std::unique_ptr<arm_compute::Tensor> m_InputToInputWeightsTensor; |
| 28 | std::unique_ptr<arm_compute::Tensor> m_InputToForgetWeightsTensor; |
| 29 | std::unique_ptr<arm_compute::Tensor> m_InputToCellWeightsTensor; |
| 30 | std::unique_ptr<arm_compute::Tensor> m_InputToOutputWeightsTensor; |
| 31 | std::unique_ptr<arm_compute::Tensor> m_RecurrentToInputWeightsTensor; |
| 32 | std::unique_ptr<arm_compute::Tensor> m_RecurrentToForgetWeightsTensor; |
| 33 | std::unique_ptr<arm_compute::Tensor> m_RecurrentToCellWeightsTensor; |
| 34 | std::unique_ptr<arm_compute::Tensor> m_RecurrentToOutputWeightsTensor; |
| 35 | std::unique_ptr<arm_compute::Tensor> m_InputGateBiasTensor; |
| 36 | std::unique_ptr<arm_compute::Tensor> m_ForgetGateBiasTensor; |
| 37 | std::unique_ptr<arm_compute::Tensor> m_CellBiasTensor; |
| 38 | std::unique_ptr<arm_compute::Tensor> m_OutputGateBiasTensor; |
| 39 | std::unique_ptr<arm_compute::Tensor> m_CellStateInTensor; |
| 40 | std::unique_ptr<arm_compute::Tensor> m_OutputStateInTensor; |
| 41 | std::unique_ptr<arm_compute::Tensor> m_CellStateOutTensor; |
| 42 | |
| 43 | void FreeUnusedTensors(); |
| 44 | }; |
| 45 | |
| 46 | arm_compute::Status NeonQuantizedLstmWorkloadValidate(const TensorInfo& input, |
| 47 | const TensorInfo& outputStateIn, |
| 48 | const TensorInfo& cellStateIn, |
| 49 | const TensorInfo& outputStateOut, |
| 50 | const TensorInfo& cellStateOut, |
| 51 | const QuantizedLstmInputParamsInfo& paramsInfo); |
| 52 | |
| 53 | } //namespace armnn |