// // Copyright © 2022 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include #include #include #include #include "NeonBaseWorkload.hpp" #include "arm_compute/runtime/NEON/functions/NEQLSTMLayer.h" #include "arm_compute/runtime/NEON/functions/NEPermute.h" #include "arm_compute/runtime/NEON/functions/NESplit.h" #include "arm_compute/runtime/NEON/functions/NEConcatenateLayer.h" namespace armnn { class NeonUnidirectionalSequenceLstmWorkload : public NeonBaseWorkload { public: NeonUnidirectionalSequenceLstmWorkload(const UnidirectionalSequenceLstmQueueDescriptor& descriptor, const WorkloadInfo& info); virtual void Execute() const override; private: // // ACL layers required to fully form a Unidirectional Sequence LSTM layer. // mutable std::unique_ptr m_Permute1; mutable std::unique_ptr m_Splitter; mutable std::vector> m_Layers; mutable std::unique_ptr m_Concat; mutable std::unique_ptr m_Permute2; // // ACL LSTM arm_compute::Tensors. // std::unique_ptr m_InputToInputWeightsTensor; std::unique_ptr m_InputToForgetWeightsTensor; std::unique_ptr m_InputToCellWeightsTensor; std::unique_ptr m_InputToOutputWeightsTensor; std::unique_ptr m_RecurrentToInputWeightsTensor; std::unique_ptr m_RecurrentToForgetWeightsTensor; std::unique_ptr m_RecurrentToCellWeightsTensor; std::unique_ptr m_RecurrentToOutputWeightsTensor; std::unique_ptr m_CellToInputWeightsTensor; std::unique_ptr m_CellToForgetWeightsTensor; std::unique_ptr m_CellToOutputWeightsTensor; std::unique_ptr m_InputGateBiasTensor; std::unique_ptr m_ForgetGateBiasTensor; std::unique_ptr m_CellBiasTensor; std::unique_ptr m_OutputGateBiasTensor; std::unique_ptr m_ProjectionWeightsTensor; std::unique_ptr m_ProjectionBiasTensor; std::unique_ptr m_InputLayerNormWeightsTensor; std::unique_ptr m_ForgetLayerNormWeightsTensor; std::unique_ptr m_CellLayerNormWeightsTensor; std::unique_ptr m_OutputLayerNormWeightsTensor; // // Additional ACL arm_compute::Tensors and std::vector. // Required to perform splitting, concatenation and permutations. // arm_compute::Tensor m_PermuteFirstOut; std::vector m_SplitterOutputsTensors; std::vector m_ConcatInputsTensors; std::vector m_SplitterOutputs; std::vector m_ConcatInputs; arm_compute::Tensor concat_out; void FreeUnusedTensors(); }; arm_compute::Status NeonUnidirectionalSequenceLstmWorkloadValidate(const TensorInfo& input, const TensorInfo& outputStateIn, const TensorInfo& cellStateIn, const TensorInfo& outputStateOut, const TensorInfo& cellStateOut, const TensorInfo& output, const UnidirectionalSequenceLstmDescriptor& descriptor, const LstmInputParamsInfo& paramsInfo); } //namespace armnn