From c577f2c6a3b4ddb6ba87a882723c53a248afbeba Mon Sep 17 00:00:00 2001 From: telsoa01 Date: Fri, 31 Aug 2018 09:22:23 +0100 Subject: Release 18.08 --- src/armnn/layers/LstmLayer.hpp | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/armnn/layers/LstmLayer.hpp (limited to 'src/armnn/layers/LstmLayer.hpp') 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 m_InputToInputWeights; + std::unique_ptr m_RecurrentToInputWeights; + std::unique_ptr m_CellToInputWeights; + std::unique_ptr m_InputGateBias; +}; + +struct LstmOptProjectionParameters +{ + std::unique_ptr m_ProjectionWeights; + std::unique_ptr m_ProjectionBias; +}; + +struct LstmOptPeepholeParameters +{ + std::unique_ptr m_CellToForgetWeights; + std::unique_ptr m_CellToOutputWeights; +}; + +struct LstmBasicParameters +{ + std::unique_ptr m_InputToForgetWeights; + std::unique_ptr m_InputToCellWeights; + std::unique_ptr m_InputToOutputWeights; + std::unique_ptr m_RecurrentToForgetWeights; + std::unique_ptr m_RecurrentToCellWeights; + std::unique_ptr m_RecurrentToOutputWeights; + std::unique_ptr m_ForgetGateBias; + std::unique_ptr m_CellBias; + std::unique_ptr m_OutputGateBias; +}; + +class LstmLayer : public LayerWithParameters +{ +public: + + LstmBasicParameters m_BasicParameters; + LstmOptCifgParameters m_CifgParameters; + LstmOptProjectionParameters m_ProjectionParameters; + LstmOptPeepholeParameters m_PeepholeParameters; + + virtual std::unique_ptr CreateWorkload(const Graph& graph, + const IWorkloadFactory& factory) const override; + LstmLayer* Clone(Graph& graph) const override; + + void ValidateTensorShapesFromInputs() override; + std::vector InferOutputShapes(const std::vector& inputShapes) const override; + +protected: + LstmLayer(const LstmDescriptor& param, const char* name); + ~LstmLayer() = default; + + Layer::ConstantTensors GetConstantTensorsByRef() override; +}; + +} // namespace -- cgit v1.2.1