diff options
author | Ryan OShea <Ryan.OShea2@arm.com> | 2020-05-13 16:36:19 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2020-05-20 12:59:34 +0000 |
commit | 2323af4542db474d42e643051e38bbc65f5844e7 (patch) | |
tree | 0c081bc35b11d283d39f5a9e9edaf419e457ff83 /src/backends/cl/workloads/ClQLstmWorkload.hpp | |
parent | cc34093a57ea486e48f9aa66fc8b98a7bbdefef1 (diff) | |
download | armnn-2323af4542db474d42e643051e38bbc65f5844e7.tar.gz |
IVGCVSW-4450 Add CL Enhanced Quantized LSTM Workload
* Adds QLstm CL workload
* Added Layer and CreateWorkload tests
Signed-off-by: Ryan OShea <Ryan.OShea2@arm.com>
Signed-off-by: James Conroy <james.conroy@arm.com>
Change-Id: I32335e528467bfd619edb249d2971705ac2a6163
Diffstat (limited to 'src/backends/cl/workloads/ClQLstmWorkload.hpp')
-rw-r--r-- | src/backends/cl/workloads/ClQLstmWorkload.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/backends/cl/workloads/ClQLstmWorkload.hpp b/src/backends/cl/workloads/ClQLstmWorkload.hpp new file mode 100644 index 0000000000..f98c9b3f9a --- /dev/null +++ b/src/backends/cl/workloads/ClQLstmWorkload.hpp @@ -0,0 +1,66 @@ +// +// Copyright © 2020 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <armnn/Descriptors.hpp> +#include <armnn/LstmParams.hpp> +#include <backendsCommon/Workload.hpp> +#include <backendsCommon/WorkloadData.hpp> + +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/runtime/CL/functions/CLQLSTMLayer.h" + +namespace armnn +{ + +class ClQLstmWorkload : public BaseWorkload<QLstmQueueDescriptor> +{ +public: + ClQLstmWorkload(const QLstmQueueDescriptor& descriptor, const WorkloadInfo& info); + virtual void Execute() const override; + +private: + mutable arm_compute::CLQLSTMLayer m_QLstmLayer; + + std::unique_ptr<arm_compute::CLTensor> m_InputToInputWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_InputToForgetWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_InputToCellWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_InputToOutputWeightsTensor; + + std::unique_ptr<arm_compute::CLTensor> m_RecurrentToInputWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_RecurrentToForgetWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_RecurrentToCellWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_RecurrentToOutputWeightsTensor; + + std::unique_ptr<arm_compute::CLTensor> m_CellToInputWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_CellToForgetWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_CellToOutputWeightsTensor; + + std::unique_ptr<arm_compute::CLTensor> m_InputGateBiasTensor; + std::unique_ptr<arm_compute::CLTensor> m_ForgetGateBiasTensor; + std::unique_ptr<arm_compute::CLTensor> m_CellBiasTensor; + std::unique_ptr<arm_compute::CLTensor> m_OutputGateBiasTensor; + + std::unique_ptr<arm_compute::CLTensor> m_ProjectionWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_ProjectionBiasTensor; + + std::unique_ptr<arm_compute::CLTensor> m_InputLayerNormWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_ForgetLayerNormWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_CellLayerNormWeightsTensor; + std::unique_ptr<arm_compute::CLTensor> m_OutputLayerNormWeightsTensor; + + void FreeUnusedTensors(); +}; + +arm_compute::Status ClQLstmWorkloadValidate(const TensorInfo& input, + const TensorInfo& cellStateIn, + const TensorInfo& outputStateIn, + const TensorInfo& cellStateOut, + const TensorInfo& outputStateOut, + const TensorInfo& output, + const QLstmDescriptor& descriptor, + const LstmInputParamsInfo& paramsInfo); +} //namespace armnn |