diff options
author | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
commit | c577f2c6a3b4ddb6ba87a882723c53a248afbeba (patch) | |
tree | bd7d4c148df27f8be6649d313efb24f536b7cf34 /src/armnn/layers/LstmLayer.hpp | |
parent | 4c7098bfeab1ffe1cdc77f6c15548d3e73274746 (diff) | |
download | armnn-c577f2c6a3b4ddb6ba87a882723c53a248afbeba.tar.gz |
Release 18.08
Diffstat (limited to 'src/armnn/layers/LstmLayer.hpp')
-rw-r--r-- | src/armnn/layers/LstmLayer.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/armnn/layers/LstmLayer.hpp b/src/armnn/layers/LstmLayer.hpp new file mode 100644 index 0000000000..7133ad26a5 --- /dev/null +++ b/src/armnn/layers/LstmLayer.hpp @@ -0,0 +1,70 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#pragma once + +#include "LayerWithParameters.hpp" + +namespace armnn +{ + +class ScopedCpuTensorHandle; + +struct LstmOptCifgParameters +{ + std::unique_ptr<ScopedCpuTensorHandle> m_InputToInputWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_RecurrentToInputWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_CellToInputWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_InputGateBias; +}; + +struct LstmOptProjectionParameters +{ + std::unique_ptr<ScopedCpuTensorHandle> m_ProjectionWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_ProjectionBias; +}; + +struct LstmOptPeepholeParameters +{ + std::unique_ptr<ScopedCpuTensorHandle> m_CellToForgetWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_CellToOutputWeights; +}; + +struct LstmBasicParameters +{ + std::unique_ptr<ScopedCpuTensorHandle> m_InputToForgetWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_InputToCellWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_InputToOutputWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_RecurrentToForgetWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_RecurrentToCellWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_RecurrentToOutputWeights; + std::unique_ptr<ScopedCpuTensorHandle> m_ForgetGateBias; + std::unique_ptr<ScopedCpuTensorHandle> m_CellBias; + std::unique_ptr<ScopedCpuTensorHandle> m_OutputGateBias; +}; + +class LstmLayer : public LayerWithParameters<LstmDescriptor> +{ +public: + + LstmBasicParameters m_BasicParameters; + LstmOptCifgParameters m_CifgParameters; + LstmOptProjectionParameters m_ProjectionParameters; + LstmOptPeepholeParameters m_PeepholeParameters; + + virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph, + const IWorkloadFactory& factory) const override; + LstmLayer* Clone(Graph& graph) const override; + + void ValidateTensorShapesFromInputs() override; + std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override; + +protected: + LstmLayer(const LstmDescriptor& param, const char* name); + ~LstmLayer() = default; + + Layer::ConstantTensors GetConstantTensorsByRef() override; +}; + +} // namespace |