aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2021-07-28 17:33:28 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2021-08-10 16:49:30 +0000
commite5339e7013cf24e5a34509fb0a60377e5f8a244e (patch)
treec43607bfa497d3694f92d3d080a29b338f93905a /src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp
parentc1c872f12797ef6fe52c4589113e7efc353e56eb (diff)
downloadarmnn-e5339e7013cf24e5a34509fb0a60377e5f8a244e.tar.gz
MLCE-530 Add support for UnidirectionalSequenceLstm to RefWorkloadexperimental/daves_custom_allocator_dmabuf
* Add implementation of IsUnidirectionalSequenceLstmSupported to RefLayerSupport * Add RefUnidirectionalSequenceLstmWorkload * Refactor Lstm to be able to use for Lstm and SequenceLstm * Unit tests Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: Ibc066d213213a11b955dfefbe518de643298ba0c
Diffstat (limited to 'src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp')
-rw-r--r--src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp b/src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp
new file mode 100644
index 0000000000..8ba7bdc0c6
--- /dev/null
+++ b/src/backends/reference/workloads/RefUnidirectionalSequenceLstmWorkload.hpp
@@ -0,0 +1,56 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <armnn/TypesUtils.hpp>
+
+#include <backendsCommon/Workload.hpp>
+#include <backendsCommon/WorkloadData.hpp>
+
+#include "Encoders.hpp"
+#include "Decoders.hpp"
+
+namespace armnn
+{
+
+class RefUnidirectionalSequenceLstmWorkload : public BaseWorkload<UnidirectionalSequenceLstmQueueDescriptor>
+{
+public:
+ explicit RefUnidirectionalSequenceLstmWorkload(const UnidirectionalSequenceLstmQueueDescriptor& descriptor,
+ const WorkloadInfo& info);
+
+ void Execute() const override;
+ void ExecuteAsync(WorkingMemDescriptor& workingMemDescriptor) override;
+
+
+private:
+ void Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const;
+ std::unique_ptr<ScopedTensorHandle> m_InputToInputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_InputToForgetWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_InputToCellWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_InputToOutputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_RecurrentToInputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_RecurrentToForgetWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_RecurrentToCellWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_RecurrentToOutputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_CellToInputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_CellToForgetWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_CellToOutputWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_InputGateBiasTensor;
+ std::unique_ptr<ScopedTensorHandle> m_ForgetGateBiasTensor;
+ std::unique_ptr<ScopedTensorHandle> m_CellBiasTensor;
+ std::unique_ptr<ScopedTensorHandle> m_OutputGateBiasTensor;
+ std::unique_ptr<ScopedTensorHandle> m_ProjectionWeightsTensor;
+ std::unique_ptr<ScopedTensorHandle> m_ProjectionBiasTensor;
+ std::unique_ptr<ScopedTensorHandle> m_InputLayerNormWeights;
+ std::unique_ptr<ScopedTensorHandle> m_ForgetLayerNormWeights;
+ std::unique_ptr<ScopedTensorHandle> m_CellLayerNormWeights;
+ std::unique_ptr<ScopedTensorHandle> m_OutputLayerNormWeights;
+
+ float m_LayerNormEpsilon = static_cast<float>(1e-8);
+};
+
+} //namespace armnn