ArmNN
 22.02
LstmLayer Class Reference

This layer represents a LSTM operation. More...

#include <LstmLayer.hpp>

Inheritance diagram for LstmLayer:
LayerWithParameters< LstmDescriptor > Layer IConnectableLayer

Public Member Functions

virtual std::unique_ptr< IWorkloadCreateWorkload (const IWorkloadFactory &factory) const override
 Makes a workload for the LSTM type. More...
 
LstmLayerClone (Graph &graph) const override
 Creates a dynamically-allocated copy of this layer. More...
 
void ValidateTensorShapesFromInputs () override
 Check if the input tensor shape(s) will lead to a valid configuration of LstmLayer. More...
 
std::vector< TensorShapeInferOutputShapes (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. More...
 
ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept (ILayerVisitor &visitor) const override
 
ARMNN_NO_DEPRECATE_WARN_END void ExecuteStrategy (IStrategy &strategy) const override
 Apply a visitor to this layer. More...
 
- Public Member Functions inherited from LayerWithParameters< LstmDescriptor >
const LstmDescriptorGetParameters () const override
 If the layer has a descriptor return it. More...
 
void SerializeLayerParameters (ParameterStringifyFunction &fn) const override
 Helper to serialize the layer parameters to string (currently used in DotSerializer and company). More...
 
- Public Member Functions inherited from Layer
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
 
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, DataLayout layout, const char *name)
 
const std::string & GetNameStr () const
 
const OutputHandlerGetOutputHandler (unsigned int i=0) const
 
OutputHandlerGetOutputHandler (unsigned int i=0)
 
ShapeInferenceMethod GetShapeInferenceMethod () const
 
const std::vector< InputSlot > & GetInputSlots () const
 
const std::vector< OutputSlot > & GetOutputSlots () const
 
std::vector< InputSlot >::iterator BeginInputSlots ()
 
std::vector< InputSlot >::iterator EndInputSlots ()
 
std::vector< OutputSlot >::iterator BeginOutputSlots ()
 
std::vector< OutputSlot >::iterator EndOutputSlots ()
 
bool IsOutputUnconnected ()
 
void ResetPriority () const
 
LayerPriority GetPriority () const
 
LayerType GetType () const override
 Returns the armnn::LayerType of this layer. More...
 
DataType GetDataType () const
 
const BackendIdGetBackendId () const
 
void SetBackendId (const BackendId &id)
 
virtual void CreateTensorHandles (const TensorHandleFactoryRegistry &registry, const IWorkloadFactory &factory, const bool IsMemoryManaged=true)
 
void VerifyLayerConnections (unsigned int expectedConnections, const CheckLocation &location) const
 
virtual void ReleaseConstantData ()
 
template<typename Op >
void OperateOnConstantTensors (Op op)
 
const char * GetName () const override
 Returns the name of the layer. More...
 
unsigned int GetNumInputSlots () const override
 Returns the number of connectable input slots. More...
 
unsigned int GetNumOutputSlots () const override
 Returns the number of connectable output slots. More...
 
const InputSlotGetInputSlot (unsigned int index) const override
 Get a const input slot handle by slot index. More...
 
InputSlotGetInputSlot (unsigned int index) override
 Get the input slot handle by slot index. More...
 
const OutputSlotGetOutputSlot (unsigned int index=0) const override
 Get the const output slot handle by slot index. More...
 
OutputSlotGetOutputSlot (unsigned int index=0) override
 Get the output slot handle by slot index. More...
 
void SetGuid (LayerGuid guid)
 
LayerGuid GetGuid () const final
 Returns the unique id of the layer. More...
 
void AddRelatedLayerName (const std::string layerName)
 
const std::list< std::string > & GetRelatedLayerNames ()
 
virtual void Reparent (Graph &dest, std::list< Layer *>::const_iterator iterator)=0
 
void BackendSelectionHint (Optional< BackendId > backend) final
 Provide a hint for the optimizer as to which backend to prefer for this layer. More...
 
Optional< BackendIdGetBackendHint () const
 
void SetShapeInferenceMethod (ShapeInferenceMethod shapeInferenceMethod)
 
template<typename T >
std::shared_ptr< T > GetAdditionalInformation () const
 
void SetAdditionalInfoForObject (const AdditionalInfoObjectPtr &additionalInfo)
 
- Public Member Functions inherited from IConnectableLayer
ARMNN_NO_DEPRECATE_WARN_BEGIN ARMNN_DEPRECATED_MSG_REMOVAL_DATE ("Accept is deprecated. The ILayerVisitor that works in conjunction with this " "Accept function is deprecated. Use IStrategy in combination with " "ExecuteStrategy instead, which is an ABI/API stable version of the " "visitor pattern.", "22.05") virtual void Accept(ILayerVisitor &visitor) const =0
 Apply a visitor to this layer. More...
 

Public Attributes

LstmBasicParameters m_BasicParameters
 
LstmOptCifgParameters m_CifgParameters
 
LstmOptProjectionParameters m_ProjectionParameters
 
LstmOptPeepholeParameters m_PeepholeParameters
 
LstmOptLayerNormParameters m_LayerNormParameters
 

Protected Member Functions

 LstmLayer (const LstmDescriptor &param, const char *name)
 Constructor to create a LstmLayer. More...
 
 ~LstmLayer ()=default
 Default destructor. More...
 
Layer::ConstantTensors GetConstantTensorsByRef () override
 Retrieve the handles to the constant values stored by the layer. More...
 
- Protected Member Functions inherited from LayerWithParameters< LstmDescriptor >
 LayerWithParameters (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const LstmDescriptor &param, const char *name)
 
 ~LayerWithParameters ()=default
 
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *LayerCreateWorkload. More...
 
void ExecuteStrategy (IStrategy &strategy) const override
 Apply a visitor to this layer. More...
 
- Protected Member Functions inherited from Layer
virtual ~Layer ()=default
 
template<typename QueueDescriptor >
void CollectQueueDescriptorInputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
template<typename QueueDescriptor >
void CollectQueueDescriptorOutputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
 
void ValidateAndCopyShape (const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
 
void VerifyShapeInferenceType (const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
 
template<typename QueueDescriptor >
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *LayerCreateWorkload. More...
 
template<typename LayerType , typename ... Params>
LayerTypeCloneBase (Graph &graph, Params &&... params) const
 
void SetAdditionalInfo (QueueDescriptor &descriptor) const
 
- Protected Member Functions inherited from IConnectableLayer
 ~IConnectableLayer ()
 Objects are not deletable via the handle. More...
 

Additional Inherited Members

- Public Types inherited from LayerWithParameters< LstmDescriptor >
using DescriptorType = LstmDescriptor
 
- Public Types inherited from IConnectableLayer
using ConstantTensors = std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >>
 
- Protected Attributes inherited from LayerWithParameters< LstmDescriptor >
LstmDescriptor m_Param
 The parameters for the layer (not including tensor-valued weights etc.). More...
 
- Protected Attributes inherited from Layer
AdditionalInfoObjectPtr m_AdditionalInfoObject
 
std::vector< OutputHandlerm_OutputHandlers
 
ShapeInferenceMethod m_ShapeInferenceMethod
 

Detailed Description

This layer represents a LSTM operation.

Definition at line 16 of file LstmLayer.hpp.

Constructor & Destructor Documentation

◆ LstmLayer()

LstmLayer ( const LstmDescriptor param,
const char *  name 
)
protected

Constructor to create a LstmLayer.

Parameters
[in]paramLstmDescriptor to configure the lstm operation.
[in]nameOptional name for the layer.

Definition at line 17 of file LstmLayer.cpp.

References armnn::Lstm.

18  : LayerWithParameters(3, 4, LayerType::Lstm, param, name)
19 {
20 }
LayerWithParameters(unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const LstmDescriptor &param, const char *name)

◆ ~LstmLayer()

~LstmLayer ( )
protecteddefault

Default destructor.

Member Function Documentation

◆ Accept()

ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept ( ILayerVisitor &  visitor) const
override

Definition at line 305 of file LstmLayer.cpp.

References ARMNN_NO_DEPRECATE_WARN_END, Layer::GetName(), LayerWithParameters< LstmDescriptor >::GetParameters(), ManagedConstTensorHandle::GetTensorInfo(), LstmLayer::m_BasicParameters, LstmInputParams::m_CellBias, LstmBasicParameters::m_CellBias, LstmOptLayerNormParameters::m_CellLayerNormWeights, LstmInputParams::m_CellLayerNormWeights, LstmInputParams::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmInputParams::m_CellToInputWeights, LstmInputParams::m_CellToOutputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmLayer::m_CifgParameters, LstmInputParams::m_ForgetGateBias, LstmBasicParameters::m_ForgetGateBias, LstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmInputParams::m_ForgetLayerNormWeights, LstmOptCifgParameters::m_InputGateBias, LstmInputParams::m_InputGateBias, LstmOptLayerNormParameters::m_InputLayerNormWeights, LstmInputParams::m_InputLayerNormWeights, LstmInputParams::m_InputToCellWeights, LstmBasicParameters::m_InputToCellWeights, LstmInputParams::m_InputToForgetWeights, LstmBasicParameters::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmInputParams::m_InputToInputWeights, LstmInputParams::m_InputToOutputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmLayer::m_LayerNormParameters, LstmInputParams::m_OutputGateBias, LstmBasicParameters::m_OutputGateBias, LstmOptLayerNormParameters::m_OutputLayerNormWeights, LstmInputParams::m_OutputLayerNormWeights, LstmLayer::m_PeepholeParameters, LstmOptProjectionParameters::m_ProjectionBias, LstmInputParams::m_ProjectionBias, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmInputParams::m_ProjectionWeights, LstmInputParams::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmInputParams::m_RecurrentToForgetWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, LstmInputParams::m_RecurrentToInputWeights, LstmInputParams::m_RecurrentToOutputWeights, LstmBasicParameters::m_RecurrentToOutputWeights, and ManagedConstTensorHandle::Map().

306 {
307  LstmInputParams inputParams;
308  ManagedConstTensorHandle managedInputToForgetWeights(m_BasicParameters.m_InputToForgetWeights);
309  ManagedConstTensorHandle managedInputToCellWeights(m_BasicParameters.m_InputToCellWeights);
310  ManagedConstTensorHandle managedInputToOutputWeights(m_BasicParameters.m_InputToOutputWeights);
311  ManagedConstTensorHandle managedRecurrentToForgetWeights(m_BasicParameters.m_RecurrentToForgetWeights);
312  ManagedConstTensorHandle managedRecurrentToCellWeights(m_BasicParameters.m_RecurrentToCellWeights);
313  ManagedConstTensorHandle managedRecurrentToOutputWeights(m_BasicParameters.m_RecurrentToOutputWeights);
314  ManagedConstTensorHandle managedForgetGateBias(m_BasicParameters.m_ForgetGateBias);
315  ManagedConstTensorHandle managedCellBias(m_BasicParameters.m_CellBias);
316  ManagedConstTensorHandle managedOutputGateBias(m_BasicParameters.m_OutputGateBias);
317 
318  // Cifg parameters
319  ManagedConstTensorHandle managedInputToInputWeights(m_CifgParameters.m_InputToInputWeights);
320  ManagedConstTensorHandle managedRecurrentToInputWeights(m_CifgParameters.m_RecurrentToInputWeights);
321  ManagedConstTensorHandle managedInputGateBias(m_CifgParameters.m_InputGateBias);
322 
323  // Projection parameters
324  ManagedConstTensorHandle managedProjectionWeights(m_ProjectionParameters.m_ProjectionWeights);
325  ManagedConstTensorHandle managedProjectionBias(m_ProjectionParameters.m_ProjectionBias);
326 
327  // Peephole parameters
328  ManagedConstTensorHandle managedCellToInputWeights(m_PeepholeParameters.m_CellToInputWeights);
329  ManagedConstTensorHandle managedCellToForgetWeights(m_PeepholeParameters.m_CellToForgetWeights);
330  ManagedConstTensorHandle managedCellToOutputWeights(m_PeepholeParameters.m_CellToOutputWeights);
331 
332  // Layer normalisation parameters
333  ManagedConstTensorHandle managedInputLayerNormWeights(m_LayerNormParameters.m_InputLayerNormWeights);
334  ManagedConstTensorHandle managedForgetLayerNormWeights(m_LayerNormParameters.m_ForgetLayerNormWeights);
335  ManagedConstTensorHandle managedCellLayerNormWeights(m_LayerNormParameters.m_CellLayerNormWeights);
336  ManagedConstTensorHandle managedOutputLayerNormWeights(m_LayerNormParameters.m_OutputLayerNormWeights);
337 
338  ConstTensor inputToInputWeightsTensor;
340  {
341  ConstTensor inputToInputWeightsTensorCopy(managedInputToInputWeights.GetTensorInfo(),
342  managedInputToInputWeights.Map());
343  inputToInputWeightsTensor = inputToInputWeightsTensorCopy;
344  inputParams.m_InputToInputWeights = &inputToInputWeightsTensor;
345  }
346  ConstTensor inputToForgetWeightsTensor;
348  {
349  ConstTensor inputToForgetWeightsTensorCopy(managedInputToForgetWeights.GetTensorInfo(),
350  managedInputToForgetWeights.Map());
351  inputToForgetWeightsTensor = inputToForgetWeightsTensorCopy;
352  inputParams.m_InputToForgetWeights = &inputToForgetWeightsTensor;
353  }
354  ConstTensor inputToCellWeightsTensor;
356  {
357  ConstTensor inputToCellWeightsTensorCopy(managedInputToCellWeights.GetTensorInfo(),
358  managedInputToCellWeights.Map());
359  inputToCellWeightsTensor = inputToCellWeightsTensorCopy;
360  inputParams.m_InputToCellWeights = &inputToCellWeightsTensor;
361  }
362  ConstTensor inputToOutputWeightsTensor;
364  {
365  ConstTensor inputToOutputWeightsTensorCopy(managedInputToOutputWeights.GetTensorInfo(),
366  managedInputToOutputWeights.Map());
367  inputToOutputWeightsTensor = inputToOutputWeightsTensorCopy;
368  inputParams.m_InputToOutputWeights = &inputToOutputWeightsTensor;
369  }
370  ConstTensor recurrentToInputWeightsTensor;
372  {
373  ConstTensor recurrentToInputWeightsTensorCopy(
374  managedRecurrentToInputWeights.GetTensorInfo(),
375  managedRecurrentToInputWeights.Map());
376  recurrentToInputWeightsTensor = recurrentToInputWeightsTensorCopy;
377  inputParams.m_RecurrentToInputWeights = &recurrentToInputWeightsTensor;
378  }
379  ConstTensor recurrentToForgetWeightsTensor;
381  {
382  ConstTensor recurrentToForgetWeightsTensorCopy(
383  managedRecurrentToForgetWeights.GetTensorInfo(),
384  managedRecurrentToForgetWeights.Map());
385  recurrentToForgetWeightsTensor = recurrentToForgetWeightsTensorCopy;
386  inputParams.m_RecurrentToForgetWeights = &recurrentToForgetWeightsTensor;
387  }
388  ConstTensor recurrentToCellWeightsTensor;
390  {
391  ConstTensor recurrentToCellWeightsTensorCopy(
392  managedRecurrentToCellWeights.GetTensorInfo(),
393  managedRecurrentToCellWeights.Map());
394  recurrentToCellWeightsTensor = recurrentToCellWeightsTensorCopy;
395  inputParams.m_RecurrentToCellWeights = &recurrentToCellWeightsTensor;
396  }
397  ConstTensor recurrentToOutputWeightsTensor;
399  {
400  ConstTensor recurrentToOutputWeightsTensorCopy(
401  managedRecurrentToOutputWeights.GetTensorInfo(),
402  managedRecurrentToOutputWeights.Map());
403  recurrentToOutputWeightsTensor = recurrentToOutputWeightsTensorCopy;
404  inputParams.m_RecurrentToOutputWeights = &recurrentToOutputWeightsTensor;
405  }
406  ConstTensor cellToInputWeightsTensor;
408  {
409  ConstTensor cellToInputWeightsTensorCopy(managedCellToInputWeights.GetTensorInfo(),
410  managedCellToInputWeights.Map());
411  cellToInputWeightsTensor = cellToInputWeightsTensorCopy;
412  inputParams.m_CellToInputWeights = &cellToInputWeightsTensor;
413  }
414  ConstTensor cellToForgetWeightsTensor;
416  {
417  ConstTensor cellToForgetWeightsTensorCopy(managedCellToForgetWeights.GetTensorInfo(),
418  managedCellToForgetWeights.Map());
419  cellToForgetWeightsTensor = cellToForgetWeightsTensorCopy;
420  inputParams.m_CellToForgetWeights = &cellToForgetWeightsTensor;
421  }
422  ConstTensor cellToOutputWeightsTensor;
424  {
425  ConstTensor cellToOutputWeightsTensorCopy(managedCellToOutputWeights.GetTensorInfo(),
426  managedCellToOutputWeights.Map());
427  cellToOutputWeightsTensor = cellToOutputWeightsTensorCopy;
428  inputParams.m_CellToOutputWeights = &cellToOutputWeightsTensor;
429  }
430  ConstTensor inputGateBiasTensor;
431  if (m_CifgParameters.m_InputGateBias != nullptr)
432  {
433  ConstTensor inputGateBiasTensorCopy(managedInputGateBias.GetTensorInfo(),
434  managedInputGateBias.Map());
435  inputGateBiasTensor = inputGateBiasTensorCopy;
436  inputParams.m_InputGateBias = &inputGateBiasTensor;
437  }
438  ConstTensor forgetGateBiasTensor;
439  if (m_BasicParameters.m_ForgetGateBias != nullptr)
440  {
441  ConstTensor forgetGateBiasTensorCopy(managedForgetGateBias.GetTensorInfo(),
442  managedForgetGateBias.Map());
443  forgetGateBiasTensor = forgetGateBiasTensorCopy;
444  inputParams.m_ForgetGateBias = &forgetGateBiasTensor;
445  }
446  ConstTensor cellBiasTensor;
447  if (m_BasicParameters.m_CellBias != nullptr)
448  {
449  ConstTensor cellBiasTensorCopy(managedCellBias.GetTensorInfo(),
450  managedCellBias.Map());
451  cellBiasTensor = cellBiasTensorCopy;
452  inputParams.m_CellBias = &cellBiasTensor;
453  }
454  ConstTensor outputGateBias;
455  if (m_BasicParameters.m_OutputGateBias != nullptr)
456  {
457  ConstTensor outputGateBiasCopy(managedOutputGateBias.GetTensorInfo(),
458  managedOutputGateBias.Map());
459  outputGateBias = outputGateBiasCopy;
460  inputParams.m_OutputGateBias = &outputGateBias;
461  }
462  ConstTensor projectionWeightsTensor;
464  {
465  ConstTensor projectionWeightsTensorCopy(managedProjectionWeights.GetTensorInfo(),
466  managedProjectionWeights.Map());
467  projectionWeightsTensor = projectionWeightsTensorCopy;
468  inputParams.m_ProjectionWeights = &projectionWeightsTensor;
469  }
470  ConstTensor projectionBiasTensor;
472  {
473  ConstTensor projectionBiasTensorCopy(managedProjectionBias.GetTensorInfo(),
474  managedProjectionBias.Map());
475  projectionBiasTensor = projectionBiasTensorCopy;
476  inputParams.m_ProjectionBias = &projectionBiasTensor;
477  }
478  ConstTensor inputLayerNormTensor;
480  {
481  ConstTensor inputLayerNormTensorCopy(managedInputLayerNormWeights.GetTensorInfo(),
482  managedInputLayerNormWeights.Map());
483  inputLayerNormTensor = inputLayerNormTensorCopy;
484  inputParams.m_InputLayerNormWeights = &inputLayerNormTensor;
485  }
486  ConstTensor forgetLayerNormTensor;
488  {
489  ConstTensor forgetLayerNormTensorCopy(managedForgetLayerNormWeights.GetTensorInfo(),
490  managedForgetLayerNormWeights.Map());
491  forgetLayerNormTensor = forgetLayerNormTensorCopy;
492  inputParams.m_ForgetLayerNormWeights = &forgetLayerNormTensor;
493  }
494  ConstTensor cellLayerNormTensor;
496  {
497  ConstTensor cellLayerNormTensorCopy(managedCellLayerNormWeights.GetTensorInfo(),
498  managedCellLayerNormWeights.Map());
499  cellLayerNormTensor = cellLayerNormTensorCopy;
500  inputParams.m_CellLayerNormWeights = &cellLayerNormTensor;
501  }
502  ConstTensor outputLayerNormTensor;
504  {
505  ConstTensor outputLayerNormTensorCopy(managedOutputLayerNormWeights.GetTensorInfo(),
506  managedOutputLayerNormWeights.Map());
507  outputLayerNormTensor = outputLayerNormTensorCopy;
508  inputParams.m_OutputLayerNormWeights = &outputLayerNormTensor;
509  }
510 
511 
512  visitor.VisitLstmLayer(this, GetParameters(), inputParams, GetName());
513 }
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].
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
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
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
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].
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:316
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].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

◆ Clone()

LstmLayer * Clone ( Graph graph) const
overridevirtual

Creates a dynamically-allocated copy of this layer.

Parameters
[in]graphThe graph into which this layer is being cloned.

Implements Layer.

Definition at line 80 of file LstmLayer.cpp.

References Layer::GetName(), LstmLayer::m_BasicParameters, LstmBasicParameters::m_CellBias, LstmOptLayerNormParameters::m_CellLayerNormWeights, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmLayer::m_CifgParameters, LstmBasicParameters::m_ForgetGateBias, LstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmOptCifgParameters::m_InputGateBias, LstmOptLayerNormParameters::m_InputLayerNormWeights, LstmBasicParameters::m_InputToCellWeights, LstmBasicParameters::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmLayer::m_LayerNormParameters, LstmBasicParameters::m_OutputGateBias, LstmOptLayerNormParameters::m_OutputLayerNormWeights, LayerWithParameters< LstmDescriptor >::m_Param, LstmLayer::m_PeepholeParameters, LstmOptProjectionParameters::m_ProjectionBias, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, and LstmBasicParameters::m_RecurrentToOutputWeights.

81 {
82  auto layer = CloneBase<LstmLayer>(graph, m_Param, GetName());
83 
84  layer->m_BasicParameters.m_InputToForgetWeights = m_BasicParameters.m_InputToForgetWeights ?
86  : nullptr;
87  layer->m_BasicParameters.m_InputToCellWeights = m_BasicParameters.m_InputToCellWeights ?
89  layer->m_BasicParameters.m_InputToOutputWeights = m_BasicParameters.m_InputToOutputWeights ?
91  layer->m_BasicParameters.m_RecurrentToForgetWeights = m_BasicParameters.m_RecurrentToForgetWeights ?
93  layer->m_BasicParameters.m_RecurrentToCellWeights = m_BasicParameters.m_RecurrentToCellWeights ?
95  layer->m_BasicParameters.m_RecurrentToOutputWeights = m_BasicParameters.m_RecurrentToOutputWeights ?
97  layer->m_BasicParameters.m_ForgetGateBias = m_BasicParameters.m_ForgetGateBias ?
99  layer->m_BasicParameters.m_CellBias = m_BasicParameters.m_CellBias ?
100  m_BasicParameters.m_CellBias : nullptr;
101  layer->m_BasicParameters.m_OutputGateBias = m_BasicParameters.m_OutputGateBias ?
103 
104  if (!m_Param.m_CifgEnabled)
105  {
106  layer->m_CifgParameters.m_InputToInputWeights = m_CifgParameters.m_InputToInputWeights ?
108  layer->m_CifgParameters.m_RecurrentToInputWeights = m_CifgParameters.m_RecurrentToInputWeights ?
110  layer->m_CifgParameters.m_InputGateBias = m_CifgParameters.m_InputGateBias ?
112  }
113 
114  if (m_Param.m_ProjectionEnabled)
115  {
116  layer->m_ProjectionParameters.m_ProjectionWeights = m_ProjectionParameters.m_ProjectionWeights ?
118  layer->m_ProjectionParameters.m_ProjectionBias = m_ProjectionParameters.m_ProjectionBias ?
120  }
121 
122  if (m_Param.m_PeepholeEnabled)
123  {
124  if (!m_Param.m_CifgEnabled)
125  {
126  layer->m_PeepholeParameters.m_CellToInputWeights = m_PeepholeParameters.m_CellToInputWeights ?
128  }
129  layer->m_PeepholeParameters.m_CellToForgetWeights = m_PeepholeParameters.m_CellToForgetWeights ?
131  layer->m_PeepholeParameters.m_CellToOutputWeights = m_PeepholeParameters.m_CellToOutputWeights ?
133  }
134 
135  if (m_Param.m_LayerNormEnabled)
136  {
137  layer->m_LayerNormParameters.m_InputLayerNormWeights = m_LayerNormParameters.m_InputLayerNormWeights ?
139  layer->m_LayerNormParameters.m_ForgetLayerNormWeights = m_LayerNormParameters.m_ForgetLayerNormWeights ?
141  layer->m_LayerNormParameters.m_CellLayerNormWeights = m_LayerNormParameters.m_CellLayerNormWeights ?
143  layer->m_LayerNormParameters.m_OutputLayerNormWeights = m_LayerNormParameters.m_OutputLayerNormWeights ?
145  }
146 
147  return std::move(layer);
148 }
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].
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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.).
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
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].
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:316
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].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

◆ CreateWorkload()

std::unique_ptr< IWorkload > CreateWorkload ( const IWorkloadFactory factory) const
overridevirtual

Makes a workload for the LSTM type.

Parameters
[in]graphThe graph where this layer can be found.
[in]factoryThe workload factory which will create the workload.
Returns
A pointer to the created workload, or nullptr if not created.

Implements Layer.

Definition at line 22 of file LstmLayer.cpp.

References IWorkloadFactory::CreateWorkload(), armnn::Lstm, LstmLayer::m_BasicParameters, LstmBasicParameters::m_CellBias, LstmQueueDescriptor::m_CellBias, LstmOptLayerNormParameters::m_CellLayerNormWeights, LstmQueueDescriptor::m_CellLayerNormWeights, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmQueueDescriptor::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmQueueDescriptor::m_CellToInputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmQueueDescriptor::m_CellToOutputWeights, LstmDescriptor::m_CifgEnabled, LstmLayer::m_CifgParameters, LstmBasicParameters::m_ForgetGateBias, LstmQueueDescriptor::m_ForgetGateBias, LstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmQueueDescriptor::m_ForgetLayerNormWeights, LstmOptCifgParameters::m_InputGateBias, LstmQueueDescriptor::m_InputGateBias, LstmOptLayerNormParameters::m_InputLayerNormWeights, LstmQueueDescriptor::m_InputLayerNormWeights, LstmBasicParameters::m_InputToCellWeights, LstmQueueDescriptor::m_InputToCellWeights, LstmBasicParameters::m_InputToForgetWeights, LstmQueueDescriptor::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmQueueDescriptor::m_InputToInputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmQueueDescriptor::m_InputToOutputWeights, LstmDescriptor::m_LayerNormEnabled, LstmLayer::m_LayerNormParameters, LstmBasicParameters::m_OutputGateBias, LstmQueueDescriptor::m_OutputGateBias, LstmOptLayerNormParameters::m_OutputLayerNormWeights, LstmQueueDescriptor::m_OutputLayerNormWeights, LayerWithParameters< LstmDescriptor >::m_Param, LstmDescriptor::m_PeepholeEnabled, LstmLayer::m_PeepholeParameters, LstmOptProjectionParameters::m_ProjectionBias, LstmQueueDescriptor::m_ProjectionBias, LstmDescriptor::m_ProjectionEnabled, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmQueueDescriptor::m_ProjectionWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmQueueDescriptor::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmQueueDescriptor::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, LstmQueueDescriptor::m_RecurrentToInputWeights, LstmBasicParameters::m_RecurrentToOutputWeights, LstmQueueDescriptor::m_RecurrentToOutputWeights, LayerWithParameters< LstmDescriptor >::PrepInfoAndDesc(), and Layer::SetAdditionalInfo().

23 {
24  LstmQueueDescriptor descriptor;
25 
26  // Basic parameters
27  descriptor.m_InputToForgetWeights = m_BasicParameters.m_InputToForgetWeights.get();
28  descriptor.m_InputToCellWeights = m_BasicParameters.m_InputToCellWeights.get();
29  descriptor.m_InputToOutputWeights = m_BasicParameters.m_InputToOutputWeights.get();
30  descriptor.m_RecurrentToForgetWeights = m_BasicParameters.m_RecurrentToForgetWeights.get();
31  descriptor.m_RecurrentToCellWeights = m_BasicParameters.m_RecurrentToCellWeights.get();
32  descriptor.m_RecurrentToOutputWeights = m_BasicParameters.m_RecurrentToOutputWeights.get();
33  descriptor.m_ForgetGateBias = m_BasicParameters.m_ForgetGateBias.get();
34  descriptor.m_CellBias = m_BasicParameters.m_CellBias.get();
35  descriptor.m_OutputGateBias = m_BasicParameters.m_OutputGateBias.get();
36 
37  // Cifg parameters
39  {
40  descriptor.m_InputToInputWeights = m_CifgParameters.m_InputToInputWeights.get();
41  descriptor.m_RecurrentToInputWeights = m_CifgParameters.m_RecurrentToInputWeights.get();
42  descriptor.m_InputGateBias = m_CifgParameters.m_InputGateBias.get();
43  }
44 
45  // Projection parameters
47  {
48  descriptor.m_ProjectionWeights = m_ProjectionParameters.m_ProjectionWeights.get();
49  descriptor.m_ProjectionBias = m_ProjectionParameters.m_ProjectionBias.get();
50  }
51 
52  // Peephole parameters
54  {
56  {
57  descriptor.m_CellToInputWeights = m_PeepholeParameters.m_CellToInputWeights.get();
58  }
59  descriptor.m_CellToForgetWeights = m_PeepholeParameters.m_CellToForgetWeights.get();
60  descriptor.m_CellToOutputWeights = m_PeepholeParameters.m_CellToOutputWeights.get();
61  }
62 
63  // Layer normalisation parameters
65  {
67  {
68  descriptor.m_InputLayerNormWeights = m_LayerNormParameters.m_InputLayerNormWeights.get();
69  }
70  descriptor.m_ForgetLayerNormWeights = m_LayerNormParameters.m_ForgetLayerNormWeights.get();
71  descriptor.m_CellLayerNormWeights = m_LayerNormParameters.m_CellLayerNormWeights.get();
72  descriptor.m_OutputLayerNormWeights = m_LayerNormParameters.m_OutputLayerNormWeights.get();
73  }
74 
75  SetAdditionalInfo(descriptor);
76 
77  return factory.CreateWorkload(LayerType::Lstm, descriptor, PrepInfoAndDesc(descriptor));
78 }
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.
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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.).
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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::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].
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:248
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
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].
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
bool m_LayerNormEnabled
Enable/disable layer normalization.
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
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].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

◆ ExecuteStrategy()

ARMNN_NO_DEPRECATE_WARN_END void ExecuteStrategy ( IStrategy strategy) const
overridevirtual

Apply a visitor to this layer.

Reimplemented from Layer.

Definition at line 516 of file LstmLayer.cpp.

References IStrategy::ExecuteStrategy(), Layer::GetName(), LayerWithParameters< LstmDescriptor >::GetParameters(), ManagedConstTensorHandle::GetTensorInfo(), LstmLayer::m_BasicParameters, LstmBasicParameters::m_CellBias, LstmOptLayerNormParameters::m_CellLayerNormWeights, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmDescriptor::m_CifgEnabled, LstmLayer::m_CifgParameters, LstmBasicParameters::m_ForgetGateBias, LstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmOptCifgParameters::m_InputGateBias, LstmOptLayerNormParameters::m_InputLayerNormWeights, LstmBasicParameters::m_InputToCellWeights, LstmBasicParameters::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmDescriptor::m_LayerNormEnabled, LstmLayer::m_LayerNormParameters, LstmBasicParameters::m_OutputGateBias, LstmOptLayerNormParameters::m_OutputLayerNormWeights, LstmDescriptor::m_PeepholeEnabled, LstmLayer::m_PeepholeParameters, LstmOptProjectionParameters::m_ProjectionBias, LstmDescriptor::m_ProjectionEnabled, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, LstmBasicParameters::m_RecurrentToOutputWeights, and ManagedConstTensorHandle::Map().

517 {
518  std::vector<ConstTensor> constTensors;
519 
520  LstmDescriptor descriptor = GetParameters();
521 
522  ManagedConstTensorHandle managedInputToForgetWeights(m_BasicParameters.m_InputToForgetWeights);
523  ManagedConstTensorHandle managedInputToCellWeights(m_BasicParameters.m_InputToCellWeights);
524  ManagedConstTensorHandle managedInputToOutputWeights(m_BasicParameters.m_InputToOutputWeights);
525  ManagedConstTensorHandle managedRecurrentToForgetWeights(m_BasicParameters.m_RecurrentToForgetWeights);
526  ManagedConstTensorHandle managedRecurrentToCellWeights(m_BasicParameters.m_RecurrentToCellWeights);
527  ManagedConstTensorHandle managedRecurrentToOutputWeights(m_BasicParameters.m_RecurrentToOutputWeights);
528  ManagedConstTensorHandle managedForgetGateBias(m_BasicParameters.m_ForgetGateBias);
529  ManagedConstTensorHandle managedCellBias(m_BasicParameters.m_CellBias);
530  ManagedConstTensorHandle managedOutputGateBias(m_BasicParameters.m_OutputGateBias);
531 
532  // Cifg parameters
533  ManagedConstTensorHandle managedInputToInputWeights(m_CifgParameters.m_InputToInputWeights);
534  ManagedConstTensorHandle managedRecurrentToInputWeights(m_CifgParameters.m_RecurrentToInputWeights);
535  ManagedConstTensorHandle managedInputGateBias(m_CifgParameters.m_InputGateBias);
536 
537  // Projection parameters
538  ManagedConstTensorHandle managedProjectionWeights(m_ProjectionParameters.m_ProjectionWeights);
539  ManagedConstTensorHandle managedProjectionBias(m_ProjectionParameters.m_ProjectionBias);
540 
541  // Peephole parameters
542  ManagedConstTensorHandle managedCellToInputWeights(m_PeepholeParameters.m_CellToInputWeights);
543  ManagedConstTensorHandle managedCellToForgetWeights(m_PeepholeParameters.m_CellToForgetWeights);
544  ManagedConstTensorHandle managedCellToOutputWeights(m_PeepholeParameters.m_CellToOutputWeights);
545 
546  // Layer normalisation parameters
547  ManagedConstTensorHandle managedInputLayerNormWeights(m_LayerNormParameters.m_InputLayerNormWeights);
548  ManagedConstTensorHandle managedForgetLayerNormWeights(m_LayerNormParameters.m_ForgetLayerNormWeights);
549  ManagedConstTensorHandle managedCellLayerNormWeights(m_LayerNormParameters.m_CellLayerNormWeights);
550  ManagedConstTensorHandle managedOutputLayerNormWeights(m_LayerNormParameters.m_OutputLayerNormWeights);
551 
552  // First add mandatory/basic parameters
554  {
555  constTensors.emplace_back(ConstTensor(managedInputToForgetWeights.GetTensorInfo(),
556  managedInputToForgetWeights.Map()));
557  }
559  {
560  constTensors.emplace_back(ConstTensor(managedInputToCellWeights.GetTensorInfo(),
561  managedInputToCellWeights.Map()));
562  }
564  {
565  constTensors.emplace_back(ConstTensor(managedInputToOutputWeights.GetTensorInfo(),
566  managedInputToOutputWeights.Map()));
567  }
569  {
570  constTensors.emplace_back(ConstTensor(
571  managedRecurrentToForgetWeights.GetTensorInfo(),
572  managedRecurrentToForgetWeights.Map()));
573  }
575  {
576  constTensors.emplace_back(ConstTensor(
577  managedRecurrentToCellWeights.GetTensorInfo(),
578  managedRecurrentToCellWeights.Map()));
579  }
581  {
582  constTensors.emplace_back(ConstTensor(
583  managedRecurrentToOutputWeights.GetTensorInfo(),
584  managedRecurrentToOutputWeights.Map()));
585  }
586  if (m_BasicParameters.m_ForgetGateBias != nullptr)
587  {
588  constTensors.emplace_back(ConstTensor(managedForgetGateBias.GetTensorInfo(),
589  managedForgetGateBias.Map()));
590  }
591  if (m_BasicParameters.m_CellBias != nullptr)
592  {
593  constTensors.emplace_back(ConstTensor(managedCellBias.GetTensorInfo(),
594  managedCellBias.Map()));
595  }
596  if (m_BasicParameters.m_OutputGateBias != nullptr)
597  {
598  constTensors.emplace_back(ConstTensor(managedOutputGateBias.GetTensorInfo(),
599  managedOutputGateBias.Map()));
600  }
601 
602  // Add cifg parameters
603  if (!descriptor.m_CifgEnabled)
604  {
606  {
607  constTensors.emplace_back(ConstTensor(managedInputToInputWeights.GetTensorInfo(),
608  managedInputToInputWeights.Map()));
609  }
611  {
612  constTensors.emplace_back(ConstTensor(
613  managedRecurrentToInputWeights.GetTensorInfo(),
614  managedRecurrentToInputWeights.Map()));
615  }
616  if (m_CifgParameters.m_InputGateBias != nullptr)
617  {
618  constTensors.emplace_back(ConstTensor(managedInputGateBias.GetTensorInfo(),
619  managedInputGateBias.Map()));
620  }
621  }
622 
623  // Add peephole parameters
624  if (descriptor.m_PeepholeEnabled)
625  {
626  if (!descriptor.m_CifgEnabled)
627  {
629  {
630  constTensors.emplace_back(ConstTensor(managedCellToInputWeights.GetTensorInfo(),
631  managedCellToInputWeights.Map()));
632  }
633  }
635  {
636  constTensors.emplace_back(ConstTensor(managedCellToForgetWeights.GetTensorInfo(),
637  managedCellToForgetWeights.Map()));
638  }
640  {
641  constTensors.emplace_back(ConstTensor(managedCellToOutputWeights.GetTensorInfo(),
642  managedCellToOutputWeights.Map()));
643  }
644  }
645 
646  // Add projection parameters
647  if (descriptor.m_ProjectionEnabled)
648  {
650  {
651  constTensors.emplace_back(ConstTensor(managedProjectionWeights.GetTensorInfo(),
652  managedProjectionWeights.Map()));
653  }
655  {
656  constTensors.emplace_back(ConstTensor(managedProjectionBias.GetTensorInfo(),
657  managedProjectionBias.Map()));
658  }
659  }
660 
661  // Add norm parameters
662  if (descriptor.m_LayerNormEnabled)
663  {
664  if (!descriptor.m_CifgEnabled)
665  {
667  {
668  constTensors.emplace_back(ConstTensor(managedInputLayerNormWeights.GetTensorInfo(),
669  managedInputLayerNormWeights.Map()));
670  }
671  }
673  {
674  constTensors.emplace_back(ConstTensor(managedForgetLayerNormWeights.GetTensorInfo(),
675  managedForgetLayerNormWeights.Map()));
676  }
678  {
679  constTensors.emplace_back(ConstTensor(managedCellLayerNormWeights.GetTensorInfo(),
680  managedCellLayerNormWeights.Map()));
681  }
683  {
684  constTensors.emplace_back(ConstTensor(managedOutputLayerNormWeights.GetTensorInfo(),
685  managedOutputLayerNormWeights.Map()));
686  }
687  }
688 
689  strategy.ExecuteStrategy(this, GetParameters(), constTensors, GetName());
690 }
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].
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
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
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
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].
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:316
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].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

◆ GetConstantTensorsByRef()

Layer::ConstantTensors GetConstantTensorsByRef ( )
overrideprotectedvirtual

Retrieve the handles to the constant values stored by the layer.

Returns
A vector of the constant tensors stored by this layer.

Reimplemented from Layer.

Definition at line 270 of file LstmLayer.cpp.

References ARMNN_NO_DEPRECATE_WARN_BEGIN, LstmLayer::m_BasicParameters, LstmBasicParameters::m_CellBias, LstmOptLayerNormParameters::m_CellLayerNormWeights, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmLayer::m_CifgParameters, LstmBasicParameters::m_ForgetGateBias, LstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmOptCifgParameters::m_InputGateBias, LstmOptLayerNormParameters::m_InputLayerNormWeights, LstmBasicParameters::m_InputToCellWeights, LstmBasicParameters::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmLayer::m_LayerNormParameters, LstmBasicParameters::m_OutputGateBias, LstmOptLayerNormParameters::m_OutputLayerNormWeights, LstmLayer::m_PeepholeParameters, LstmOptProjectionParameters::m_ProjectionBias, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, and LstmBasicParameters::m_RecurrentToOutputWeights.

271 {
272  // For API stability DO NOT ALTER order and add new members to the end of vector
282 
283  // Cifg parameters
287 
288  // Projection parameters
291 
292  // Peephole parameters
296 
297  // Layer normalisation parameters
302 }
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].
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
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].
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
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].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

◆ InferOutputShapes()

std::vector< TensorShape > InferOutputShapes ( const std::vector< TensorShape > &  inputShapes) const
overridevirtual

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.

Parameters
[in]inputShapesThe input shapes layer has.
Returns
A vector to the inferred output shape.

Reimplemented from Layer.

Definition at line 150 of file LstmLayer.cpp.

References ARMNN_ASSERT, LstmDescriptor::m_CifgEnabled, and LayerWithParameters< LstmDescriptor >::m_Param.

Referenced by LstmLayer::ValidateTensorShapesFromInputs().

151 {
152  ARMNN_ASSERT(inputShapes.size() == 3);
153 
154  // Get input values for validation
155  unsigned int batchSize = inputShapes[0][0];
156  unsigned int outputSize = inputShapes[1][1];
157  unsigned int numUnits = inputShapes[2][1];
158 
159  std::vector<TensorShape> outShapes;
160  outShapes.push_back(TensorShape({batchSize, numUnits * (m_Param.m_CifgEnabled ? 3 : 4)}));
161  outShapes.push_back(TensorShape({batchSize, outputSize}));
162  outShapes.push_back(TensorShape({batchSize, numUnits}));
163  outShapes.push_back(TensorShape({batchSize, outputSize}));
164 
165  return outShapes;
166 }
LstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).

◆ ValidateTensorShapesFromInputs()

void ValidateTensorShapesFromInputs ( )
overridevirtual

Check if the input tensor shape(s) will lead to a valid configuration of LstmLayer.

Parameters
[in]shapeInferenceMethodIndicates if output shape shall be overwritten or just validated.

Implements Layer.

Definition at line 168 of file LstmLayer.cpp.

References ARMNN_ASSERT, ARMNN_ASSERT_MSG, CHECK_LOCATION, InputSlot::GetConnection(), Layer::GetInputSlot(), Layer::GetOutputSlot(), TensorInfo::GetShape(), armnn::GetTensorInfo(), IOutputSlot::GetTensorInfo(), OutputSlot::GetTensorInfo(), LstmLayer::InferOutputShapes(), LstmLayer::m_BasicParameters, LstmBasicParameters::m_CellBias, LstmOptPeepholeParameters::m_CellToForgetWeights, LstmOptPeepholeParameters::m_CellToInputWeights, LstmOptPeepholeParameters::m_CellToOutputWeights, LstmDescriptor::m_CifgEnabled, LstmLayer::m_CifgParameters, LstmBasicParameters::m_ForgetGateBias, LstmOptCifgParameters::m_InputGateBias, LstmBasicParameters::m_InputToCellWeights, LstmBasicParameters::m_InputToForgetWeights, LstmOptCifgParameters::m_InputToInputWeights, LstmBasicParameters::m_InputToOutputWeights, LstmBasicParameters::m_OutputGateBias, LayerWithParameters< LstmDescriptor >::m_Param, LstmDescriptor::m_PeepholeEnabled, LstmLayer::m_PeepholeParameters, LstmDescriptor::m_ProjectionEnabled, LstmLayer::m_ProjectionParameters, LstmOptProjectionParameters::m_ProjectionWeights, LstmBasicParameters::m_RecurrentToCellWeights, LstmBasicParameters::m_RecurrentToForgetWeights, LstmOptCifgParameters::m_RecurrentToInputWeights, LstmBasicParameters::m_RecurrentToOutputWeights, Layer::m_ShapeInferenceMethod, Layer::ValidateAndCopyShape(), Layer::VerifyLayerConnections(), and Layer::VerifyShapeInferenceType().

169 {
171 
172  const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
173 
175 
176  auto inferredShapes = InferOutputShapes( {
180  });
181 
182  ARMNN_ASSERT(inferredShapes.size() == 4);
183 
184  // Check if the weights are nullptr
186  "LstmLayer: m_BasicParameters.m_InputToForgetWeights should not be null.");
188  "LstmLayer: m_BasicParameters.m_InputToCellWeights should not be null.");
190  "LstmLayer: m_BasicParameters.m_InputToOutputWeights should not be null.");
192  "LstmLayer: m_BasicParameters.m_RecurrentToForgetWeights should not be null.");
194  "LstmLayer: m_BasicParameters.m_RecurrentToCellWeights should not be null.");
196  "LstmLayer: m_BasicParameters.m_RecurrentToOutputWeights should not be null.");
198  "LstmLayer: m_BasicParameters.m_ForgetGateBias should not be null.");
200  "LstmLayer: m_BasicParameters.m_CellBias should not be null.");
202  "LstmLayer: m_BasicParameters.m_OutputGateBias should not be null.");
203 
204  if (!m_Param.m_CifgEnabled)
205  {
207  "LstmLayer: m_CifgParameters.m_InputToInputWeights should not be null.");
209  "LstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not be null.");
211  "LstmLayer: m_CifgParameters.m_InputGateBias should not be null.");
212 
213  ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "LstmLayer");
214  }
215  else
216  {
218  "LstmLayer: m_CifgParameters.m_InputToInputWeights should not have a value when CIFG is enabled.");
220  "LstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not have a value when CIFG is enabled.");
222  "LstmLayer: m_CifgParameters.m_InputGateBias should not have a value when CIFG is enabled.");
223 
224  ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "LstmLayer");
225  }
226 
228  {
230  "LstmLayer: m_ProjectionParameters.m_ProjectionWeights should not be null.");
231  }
232 
234  {
235  if (!m_Param.m_CifgEnabled)
236  {
238  "LstmLayer: m_PeepholeParameters.m_CellToInputWeights should not be null "
239  "when Peephole is enabled and CIFG is disabled.");
240  }
242  "LstmLayer: m_PeepholeParameters.m_CellToForgetWeights should not be null.");
244  "LstmLayer: m_PeepholeParameters.m_CellToOutputWeights should not be null.");
245  }
246 
248  GetOutputSlot(1).GetTensorInfo().GetShape(), inferredShapes[1], m_ShapeInferenceMethod, "LstmLayer", 1);
250  GetOutputSlot(2).GetTensorInfo().GetShape(), inferredShapes[2], m_ShapeInferenceMethod, "LstmLayer", 2);
252  GetOutputSlot(3).GetTensorInfo().GetShape(), inferredShapes[3], m_ShapeInferenceMethod, "LstmLayer", 3);
253 
255  {
257  {
259  "LstmLayer: m_LayerNormParameters.m_inputLayerNormWeights should not be null.");
260  }
262  "LstmLayer: m_LayerNormParameters.m_forgetLayerNormWeights should not be null.");
264  "LstmLayer: m_LayerNormParameters.m_cellLayerNormWeights should not be null.");
266  "LstmLayer: m_LayerNormParameters.m_outputLayerNormWeights should not be null.");
267  }
268 }
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.
LstmBasicParameters m_BasicParameters
Definition: LstmLayer.hpp:20
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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.).
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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)
Definition: Layer.cpp:436
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
const IOutputSlot * GetConnection() const override
Definition: Layer.hpp:204
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
Definition: Layer.cpp:396
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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
Definition: Layer.cpp:352
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:321
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].
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
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)
Definition: Assert.hpp:14
LstmOptLayerNormParameters m_LayerNormParameters
Definition: LstmLayer.hpp:24
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].
#define CHECK_LOCATION()
Definition: Exceptions.hpp:209
LstmOptPeepholeParameters m_PeepholeParameters
Definition: LstmLayer.hpp:23
LstmOptProjectionParameters m_ProjectionParameters
Definition: LstmLayer.hpp:22
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
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].
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.
Definition: Layer.hpp:323
virtual const TensorInfo & GetTensorInfo() const =0
LstmOptCifgParameters m_CifgParameters
Definition: LstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
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.
Definition: LstmLayer.cpp:150
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:66
ShapeInferenceMethod m_ShapeInferenceMethod
Definition: Layer.hpp:415
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].

Member Data Documentation

◆ m_BasicParameters

◆ m_CifgParameters

◆ m_LayerNormParameters

◆ m_PeepholeParameters

◆ m_ProjectionParameters


The documentation for this class was generated from the following files: