82 auto layer = CloneBase<UnidirectionalSequenceLstmLayer>(graph,
m_Param,
GetName());
104 if (!m_Param.m_CifgEnabled)
114 if (m_Param.m_ProjectionEnabled)
122 if (m_Param.m_PeepholeEnabled)
124 if (!m_Param.m_CifgEnabled)
135 if (m_Param.m_LayerNormEnabled)
147 return std::move(layer);
151 const std::vector<TensorShape>& inputShapes)
const 156 unsigned int outputSize = inputShapes[1][1];
158 std::vector<TensorShape> outShapes;
161 outShapes.push_back(
TensorShape({inputShapes[0][0], inputShapes[0][1], outputSize}));
165 outShapes.push_back(
TensorShape({inputShapes[0][0], inputShapes[0][1], outputSize}));
188 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToForgetWeights should not be null.");
190 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToCellWeights should not be null.");
192 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToOutputWeights should not be null.");
194 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToForgetWeights " 195 "should not be null.");
197 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToCellWeights should not be null.");
199 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToOutputWeights " 200 "should not be null.");
202 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_ForgetGateBias should not be null.");
204 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_CellBias should not be null.");
206 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_OutputGateBias should not be null.");
211 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputToInputWeights should not be null.");
213 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_RecurrentToInputWeights " 214 "should not be null.");
216 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputGateBias should not be null.");
221 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputToInputWeights should not have a value " 222 "when CIFG is enabled.");
224 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not have a value " 225 "when CIFG is enabled.");
227 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputGateBias should not have a value " 228 "when CIFG is enabled.");
234 "UnidirectionalSequenceLstmLayer: m_ProjectionParameters.m_ProjectionWeights " 235 "should not be null.");
243 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToInputWeights " 244 "should not be null " 245 "when Peephole is enabled and CIFG is disabled.");
248 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToForgetWeights " 249 "should not be null.");
251 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToOutputWeights " 252 "should not be null.");
260 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_inputLayerNormWeights " 261 "should not be null.");
264 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_forgetLayerNormWeights " 265 "should not be null.");
267 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_cellLayerNormWeights " 268 "should not be null.");
270 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_outputLayerNormWeights " 271 "should not be null.");
315 throw armnn::Exception(
"UnidirectionalSequenceLstmLayer: VisitUnidirectionalSequenceLstmLayer is not implemented");
321 std::vector<ConstTensor> constTensors;
359 managedInputToForgetWeights.
Map()));
364 managedInputToCellWeights.
Map()));
369 managedInputToOutputWeights.
Map()));
375 managedRecurrentToForgetWeights.
Map()));
381 managedRecurrentToCellWeights.
Map()));
387 managedRecurrentToOutputWeights.
Map()));
392 managedForgetGateBias.
Map()));
397 managedCellBias.
Map()));
402 managedOutputGateBias.
Map()));
411 managedInputToInputWeights.
Map()));
417 managedRecurrentToInputWeights.
Map()));
422 managedInputGateBias.
Map()));
434 managedCellToInputWeights.
Map()));
440 managedCellToForgetWeights.
Map()));
445 managedCellToOutputWeights.
Map()));
455 managedProjectionWeights.
Map()));
460 managedProjectionBias.
Map()));
472 managedInputLayerNormWeights.
Map()));
478 managedForgetLayerNormWeights.
Map()));
483 managedCellLayerNormWeights.
Map()));
488 managedOutputLayerNormWeights.
Map()));
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
bool m_ProjectionEnabled
Enable/disable the projection layer.
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptPeepholeParameters m_PeepholeParameters
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
UnidirectionalSequenceLstmLayer(const LstmDescriptor ¶m, const char *name)
Constructor to create a UnidirectionalSequenceLstmLayer.
const TensorShape & GetShape() const
const ConstTensorHandle * m_InputGateBias
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
LstmOptProjectionParameters m_ProjectionParameters
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs, otherwise infers the output shapes from given input shapes and layer properties.
virtual void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of UnidirectionalSequenceLstmLa...
const ConstTensorHandle * m_RecurrentToCellWeights
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the UnidirectionalSequence LSTM type.
LstmOptLayerNormParameters m_LayerNormParameters
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
const ConstTensorHandle * m_InputToInputWeights
bool m_TimeMajor
Enable/disable time major.
const TensorInfo & GetTensorInfo() const
Copyright (c) 2021 ARM Limited and Contributors.
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
const LstmDescriptor & GetParameters() const override
void IgnoreUnused(Ts &&...)
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
const ConstTensorHandle * m_OutputGateBias
ARMNN_NO_DEPRECATE_WARN_END void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
const ConstTensorHandle * m_ProjectionBias
ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept(ILayerVisitor &visitor) const override
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const ConstTensorHandle * m_InputToOutputWeights
const ConstTensorHandle * m_InputToCellWeights
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const ConstTensorHandle * m_InputToForgetWeights
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >> ConstantTensors
const ConstTensorHandle * m_CellLayerNormWeights
LstmOptCifgParameters m_CifgParameters
const ConstTensorHandle * m_CellToInputWeights
An LstmDescriptor for the LstmLayer.
#define ARMNN_NO_DEPRECATE_WARN_END
#define ARMNN_ASSERT_MSG(COND, MSG)
const ConstTensorHandle * m_ProjectionWeights
LstmBasicParameters m_BasicParameters
UnidirectionalSequenceLstmLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
bool m_PeepholeEnabled
Enable/disable peephole.
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
#define ARMNN_ASSERT(COND)
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size].
void SetAdditionalInfo(QueueDescriptor &descriptor) const
const ConstTensorHandle * m_ForgetLayerNormWeights
const ConstTensorHandle * m_OutputLayerNormWeights
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
const ConstTensorHandle * m_ForgetGateBias
This layer represents a LSTM operation.
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
Layer::ConstantTensors GetConstantTensorsByRef() override
Retrieve the handles to the constant values stored by the layer.
Base class for all ArmNN exceptions so that users can filter to just those.
const ConstTensorHandle * m_CellBias
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
bool m_LayerNormEnabled
Enable/disable layer normalization.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const ConstTensorHandle * m_RecurrentToInputWeights
virtual const TensorInfo & GetTensorInfo() const =0
const char * GetName() const override
Returns the name of the layer.
const ConstTensorHandle * m_CellToForgetWeights
const ConstTensorHandle * m_RecurrentToOutputWeights
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const
const TensorInfo & GetTensorInfo() const override
const ConstTensorHandle * m_RecurrentToForgetWeights
ShapeInferenceMethod m_ShapeInferenceMethod
const ConstTensorHandle * m_CellToOutputWeights
const ConstTensorHandle * m_InputLayerNormWeights
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...