ArmNN
 22.05.01
QLstmLayer Class Reference

This layer represents a QLstm operation. More...

#include <QLstmLayer.hpp>

Inheritance diagram for QLstmLayer:
LayerWithParameters< QLstmDescriptor > Layer IConnectableLayer

Public Member Functions

virtual std::unique_ptr< IWorkloadCreateWorkload (const IWorkloadFactory &factory) const override
 Makes a workload for the QLstm type. More...
 
QLstmLayerClone (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 QLstmLayer. 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< QLstmDescriptor >
const QLstmDescriptorGetParameters () 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
 
bool GetAllowExpandedDims () 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)
 
void SetAllowExpandedDims (bool allowExpandedDims)
 
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

QLstmBasicParameters m_BasicParameters
 
QLstmOptCifgParameters m_CifgParameters
 
QLstmOptProjectionParameters m_ProjectionParameters
 
QLstmOptPeepholeParameters m_PeepholeParameters
 
QLstmOptLayerNormParameters m_LayerNormParameters
 

Protected Member Functions

 QLstmLayer (const QLstmDescriptor &param, const char *name)
 Constructor to create a QLstmLayer. More...
 
 ~QLstmLayer ()=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< QLstmDescriptor >
 LayerWithParameters (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const QLstmDescriptor &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< QLstmDescriptor >
using DescriptorType = QLstmDescriptor
 
- Public Types inherited from IConnectableLayer
using ConstantTensors = std::vector< std::reference_wrapper< std::shared_ptr< ConstTensorHandle > >>
 
- Protected Attributes inherited from LayerWithParameters< QLstmDescriptor >
QLstmDescriptor 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 QLstm operation.

Definition at line 79 of file QLstmLayer.hpp.

Constructor & Destructor Documentation

◆ QLstmLayer()

QLstmLayer ( const QLstmDescriptor param,
const char *  name 
)
protected

Constructor to create a QLstmLayer.

Parameters
[in]nameOptional name for the layer.

Definition at line 17 of file QLstmLayer.cpp.

References armnn::QLstm.

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

◆ ~QLstmLayer()

~QLstmLayer ( )
protecteddefault

Default destructor.

Member Function Documentation

◆ Accept()

ARMNN_NO_DEPRECATE_WARN_BEGIN void Accept ( ILayerVisitor &  visitor) const
override

Definition at line 307 of file QLstmLayer.cpp.

References ARMNN_NO_DEPRECATE_WARN_END, Layer::GetName(), LayerWithParameters< QLstmDescriptor >::GetParameters(), ManagedConstTensorHandle::GetTensorInfo(), QLstmLayer::m_BasicParameters, QLstmBasicParameters::m_CellBias, LstmInputParams::m_CellBias, LstmInputParams::m_CellLayerNormWeights, QLstmOptLayerNormParameters::m_CellLayerNormWeights, LstmInputParams::m_CellToForgetWeights, QLstmOptPeepholeParameters::m_CellToForgetWeights, LstmInputParams::m_CellToInputWeights, QLstmOptPeepholeParameters::m_CellToInputWeights, LstmInputParams::m_CellToOutputWeights, QLstmOptPeepholeParameters::m_CellToOutputWeights, QLstmLayer::m_CifgParameters, QLstmBasicParameters::m_ForgetGateBias, LstmInputParams::m_ForgetGateBias, LstmInputParams::m_ForgetLayerNormWeights, QLstmOptLayerNormParameters::m_ForgetLayerNormWeights, LstmInputParams::m_InputGateBias, QLstmOptCifgParameters::m_InputGateBias, LstmInputParams::m_InputLayerNormWeights, QLstmOptLayerNormParameters::m_InputLayerNormWeights, QLstmBasicParameters::m_InputToCellWeights, LstmInputParams::m_InputToCellWeights, QLstmBasicParameters::m_InputToForgetWeights, LstmInputParams::m_InputToForgetWeights, LstmInputParams::m_InputToInputWeights, QLstmOptCifgParameters::m_InputToInputWeights, QLstmBasicParameters::m_InputToOutputWeights, LstmInputParams::m_InputToOutputWeights, QLstmLayer::m_LayerNormParameters, QLstmBasicParameters::m_OutputGateBias, LstmInputParams::m_OutputGateBias, LstmInputParams::m_OutputLayerNormWeights, QLstmOptLayerNormParameters::m_OutputLayerNormWeights, QLstmLayer::m_PeepholeParameters, QLstmOptProjectionParameters::m_ProjectionBias, LstmInputParams::m_ProjectionBias, QLstmLayer::m_ProjectionParameters, QLstmOptProjectionParameters::m_ProjectionWeights, LstmInputParams::m_ProjectionWeights, QLstmBasicParameters::m_RecurrentToCellWeights, LstmInputParams::m_RecurrentToCellWeights, QLstmBasicParameters::m_RecurrentToForgetWeights, LstmInputParams::m_RecurrentToForgetWeights, LstmInputParams::m_RecurrentToInputWeights, QLstmOptCifgParameters::m_RecurrentToInputWeights, QLstmBasicParameters::m_RecurrentToOutputWeights, LstmInputParams::m_RecurrentToOutputWeights, and ManagedConstTensorHandle::Map().

308 {
309  LstmInputParams inputParams;
310  ManagedConstTensorHandle managedInputToForgetWeights(m_BasicParameters.m_InputToForgetWeights);
311  ManagedConstTensorHandle managedInputToCellWeights(m_BasicParameters.m_InputToCellWeights);
312  ManagedConstTensorHandle managedInputToOutputWeights(m_BasicParameters.m_InputToOutputWeights);
313  ManagedConstTensorHandle managedRecurrentToForgetWeights(m_BasicParameters.m_RecurrentToForgetWeights);
314  ManagedConstTensorHandle managedRecurrentToCellWeights(m_BasicParameters.m_RecurrentToCellWeights);
315  ManagedConstTensorHandle managedRecurrentToOutputWeights(m_BasicParameters.m_RecurrentToOutputWeights);
316  ManagedConstTensorHandle managedForgetGateBias(m_BasicParameters.m_ForgetGateBias);
317  ManagedConstTensorHandle managedCellBias(m_BasicParameters.m_CellBias);
318  ManagedConstTensorHandle managedOutputGateBias(m_BasicParameters.m_OutputGateBias);
319 
320  // Cifg parameters
321  ManagedConstTensorHandle managedInputToInputWeights(m_CifgParameters.m_InputToInputWeights);
322  ManagedConstTensorHandle managedRecurrentToInputWeights(m_CifgParameters.m_RecurrentToInputWeights);
323  ManagedConstTensorHandle managedInputGateBias(m_CifgParameters.m_InputGateBias);
324 
325  // Projection parameters
326  ManagedConstTensorHandle managedProjectionWeights(m_ProjectionParameters.m_ProjectionWeights);
327  ManagedConstTensorHandle managedProjectionBias(m_ProjectionParameters.m_ProjectionBias);
328 
329  // Peephole parameters
330  ManagedConstTensorHandle managedCellToInputWeights(m_PeepholeParameters.m_CellToInputWeights);
331  ManagedConstTensorHandle managedCellToForgetWeights(m_PeepholeParameters.m_CellToForgetWeights);
332  ManagedConstTensorHandle managedCellToOutputWeights(m_PeepholeParameters.m_CellToOutputWeights);
333 
334  // Layer normalisation parameters
335  ManagedConstTensorHandle managedInputLayerNormWeights(m_LayerNormParameters.m_InputLayerNormWeights);
336  ManagedConstTensorHandle managedForgetLayerNormWeights(m_LayerNormParameters.m_ForgetLayerNormWeights);
337  ManagedConstTensorHandle managedCellLayerNormWeights(m_LayerNormParameters.m_CellLayerNormWeights);
338  ManagedConstTensorHandle managedOutputLayerNormWeights(m_LayerNormParameters.m_OutputLayerNormWeights);
339 
340  ConstTensor inputToInputWeightsTensor;
342  {
343  ConstTensor inputToInputWeightsTensorCopy(managedInputToInputWeights.GetTensorInfo(),
344  managedInputToInputWeights.Map());
345  inputToInputWeightsTensor = inputToInputWeightsTensorCopy;
346  inputParams.m_InputToInputWeights = &inputToInputWeightsTensor;
347  }
348 
349  ConstTensor inputToForgetWeightsTensor;
351  {
352  ConstTensor inputToForgetWeightsTensorCopy(managedInputToForgetWeights.GetTensorInfo(),
353  managedInputToForgetWeights.Map());
354  inputToForgetWeightsTensor = inputToForgetWeightsTensorCopy;
355  inputParams.m_InputToForgetWeights = &inputToForgetWeightsTensor;
356  }
357 
358  ConstTensor inputToCellWeightsTensor;
360  {
361  ConstTensor inputToCellWeightsTensorCopy(managedInputToCellWeights.GetTensorInfo(),
362  managedInputToCellWeights.Map());
363  inputToCellWeightsTensor = inputToCellWeightsTensorCopy;
364  inputParams.m_InputToCellWeights = &inputToCellWeightsTensor;
365  }
366 
367  ConstTensor inputToOutputWeightsTensor;
369  {
370  ConstTensor inputToOutputWeightsTensorCopy(managedInputToOutputWeights.GetTensorInfo(),
371  managedInputToOutputWeights.Map());
372  inputToOutputWeightsTensor = inputToOutputWeightsTensorCopy;
373  inputParams.m_InputToOutputWeights = &inputToOutputWeightsTensor;
374  }
375 
376  ConstTensor recurrentToInputWeightsTensor;
378  {
379  ConstTensor recurrentToInputWeightsTensorCopy(
380  managedRecurrentToInputWeights.GetTensorInfo(),
381  managedRecurrentToInputWeights.Map());
382  recurrentToInputWeightsTensor = recurrentToInputWeightsTensorCopy;
383  inputParams.m_RecurrentToInputWeights = &recurrentToInputWeightsTensor;
384  }
385 
386  ConstTensor recurrentToForgetWeightsTensor;
388  {
389  ConstTensor recurrentToForgetWeightsTensorCopy(
390  managedRecurrentToForgetWeights.GetTensorInfo(),
391  managedRecurrentToForgetWeights.Map());
392  recurrentToForgetWeightsTensor = recurrentToForgetWeightsTensorCopy;
393  inputParams.m_RecurrentToForgetWeights = &recurrentToForgetWeightsTensor;
394  }
395 
396  ConstTensor recurrentToCellWeightsTensor;
398  {
399  ConstTensor recurrentToCellWeightsTensorCopy(
400  managedRecurrentToCellWeights.GetTensorInfo(),
401  managedRecurrentToCellWeights.Map());
402  recurrentToCellWeightsTensor = recurrentToCellWeightsTensorCopy;
403  inputParams.m_RecurrentToCellWeights = &recurrentToCellWeightsTensor;
404  }
405 
406  ConstTensor recurrentToOutputWeightsTensor;
408  {
409  ConstTensor recurrentToOutputWeightsTensorCopy(
410  managedRecurrentToOutputWeights.GetTensorInfo(),
411  managedRecurrentToOutputWeights.Map());
412  recurrentToOutputWeightsTensor = recurrentToOutputWeightsTensorCopy;
413  inputParams.m_RecurrentToOutputWeights = &recurrentToOutputWeightsTensor;
414  }
415 
416  ConstTensor cellToInputWeightsTensor;
418  {
419  ConstTensor cellToInputWeightsTensorCopy(managedCellToInputWeights.GetTensorInfo(),
420  managedCellToInputWeights.Map());
421  cellToInputWeightsTensor = cellToInputWeightsTensorCopy;
422  inputParams.m_CellToInputWeights = &cellToInputWeightsTensor;
423  }
424 
425  ConstTensor cellToForgetWeightsTensor;
427  {
428  ConstTensor cellToForgetWeightsTensorCopy(managedCellToForgetWeights.GetTensorInfo(),
429  managedCellToForgetWeights.Map());
430  cellToForgetWeightsTensor = cellToForgetWeightsTensorCopy;
431  inputParams.m_CellToForgetWeights = &cellToForgetWeightsTensor;
432  }
433 
434  ConstTensor cellToOutputWeightsTensor;
436  {
437  ConstTensor cellToOutputWeightsTensorCopy(managedCellToOutputWeights.GetTensorInfo(),
438  managedCellToOutputWeights.Map());
439  cellToOutputWeightsTensor = cellToOutputWeightsTensorCopy;
440  inputParams.m_CellToOutputWeights = &cellToOutputWeightsTensor;
441  }
442 
443  ConstTensor inputGateBiasTensor;
444  if (m_CifgParameters.m_InputGateBias != nullptr)
445  {
446  ConstTensor inputGateBiasTensorCopy(managedInputGateBias.GetTensorInfo(),
447  managedInputGateBias.Map());
448  inputGateBiasTensor = inputGateBiasTensorCopy;
449  inputParams.m_InputGateBias = &inputGateBiasTensor;
450  }
451 
452  ConstTensor forgetGateBiasTensor;
453  if (m_BasicParameters.m_ForgetGateBias != nullptr)
454  {
455  ConstTensor forgetGateBiasTensorCopy(managedForgetGateBias.GetTensorInfo(),
456  managedForgetGateBias.Map());
457  forgetGateBiasTensor = forgetGateBiasTensorCopy;
458  inputParams.m_ForgetGateBias = &forgetGateBiasTensor;
459  }
460 
461  ConstTensor cellBiasTensor;
462  if (m_BasicParameters.m_CellBias != nullptr)
463  {
464  ConstTensor cellBiasTensorCopy(managedCellBias.GetTensorInfo(),
465  managedCellBias.Map());
466  cellBiasTensor = cellBiasTensorCopy;
467  inputParams.m_CellBias = &cellBiasTensor;
468  }
469 
470  ConstTensor outputGateBias;
471  if (m_BasicParameters.m_OutputGateBias != nullptr)
472  {
473  ConstTensor outputGateBiasCopy(managedOutputGateBias.GetTensorInfo(),
474  managedOutputGateBias.Map());
475  outputGateBias = outputGateBiasCopy;
476  inputParams.m_OutputGateBias = &outputGateBias;
477  }
478 
479  ConstTensor projectionWeightsTensor;
481  {
482  ConstTensor projectionWeightsTensorCopy(managedProjectionWeights.GetTensorInfo(),
483  managedProjectionWeights.Map());
484  projectionWeightsTensor = projectionWeightsTensorCopy;
485  inputParams.m_ProjectionWeights = &projectionWeightsTensor;
486  }
487 
488  ConstTensor projectionBiasTensor;
490  {
491  ConstTensor projectionBiasTensorCopy(managedProjectionBias.GetTensorInfo(),
492  managedProjectionBias.Map());
493  projectionBiasTensor = projectionBiasTensorCopy;
494  inputParams.m_ProjectionBias = &projectionBiasTensor;
495  }
496 
497  ConstTensor inputLayerNormTensor;
499  {
500  ConstTensor inputLayerNormTensorCopy(managedInputLayerNormWeights.GetTensorInfo(),
501  managedInputLayerNormWeights.Map());
502  inputLayerNormTensor = inputLayerNormTensorCopy;
503  inputParams.m_InputLayerNormWeights = &inputLayerNormTensor;
504  }
505 
506  ConstTensor forgetLayerNormTensor;
508  {
509  ConstTensor forgetLayerNormTensorCopy(managedForgetLayerNormWeights.GetTensorInfo(),
510  managedForgetLayerNormWeights.Map());
511  forgetLayerNormTensor = forgetLayerNormTensorCopy;
512  inputParams.m_ForgetLayerNormWeights = &forgetLayerNormTensor;
513  }
514 
515  ConstTensor cellLayerNormTensor;
517  {
518  ConstTensor cellLayerNormTensorCopy(managedCellLayerNormWeights.GetTensorInfo(),
519  managedCellLayerNormWeights.Map());
520  cellLayerNormTensor = cellLayerNormTensorCopy;
521  inputParams.m_CellLayerNormWeights = &cellLayerNormTensor;
522  }
523 
524  ConstTensor outputLayerNormTensor;
526  {
527  ConstTensor outputLayerNormTensorCopy(managedOutputLayerNormWeights.GetTensorInfo(),
528  managedOutputLayerNormWeights.Map());
529  outputLayerNormTensor = outputLayerNormTensorCopy;
530  inputParams.m_OutputLayerNormWeights = &outputLayerNormTensor;
531  }
532 
533 
534  visitor.VisitQLstmLayer(this, GetParameters(), inputParams, GetName());
535 }
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
const QLstmDescriptor & GetParameters() const override
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:317
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
Definition: QLstmLayer.hpp:43
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24

◆ Clone()

QLstmLayer * 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 81 of file QLstmLayer.cpp.

References Layer::GetName(), QLstmLayer::m_BasicParameters, QLstmBasicParameters::m_CellBias, QLstmOptLayerNormParameters::m_CellLayerNormWeights, QLstmOptPeepholeParameters::m_CellToForgetWeights, QLstmOptPeepholeParameters::m_CellToInputWeights, QLstmOptPeepholeParameters::m_CellToOutputWeights, QLstmLayer::m_CifgParameters, QLstmBasicParameters::m_ForgetGateBias, QLstmOptLayerNormParameters::m_ForgetLayerNormWeights, QLstmOptCifgParameters::m_InputGateBias, QLstmOptLayerNormParameters::m_InputLayerNormWeights, QLstmBasicParameters::m_InputToCellWeights, QLstmBasicParameters::m_InputToForgetWeights, QLstmOptCifgParameters::m_InputToInputWeights, QLstmBasicParameters::m_InputToOutputWeights, QLstmLayer::m_LayerNormParameters, QLstmBasicParameters::m_OutputGateBias, QLstmOptLayerNormParameters::m_OutputLayerNormWeights, LayerWithParameters< QLstmDescriptor >::m_Param, QLstmLayer::m_PeepholeParameters, QLstmOptProjectionParameters::m_ProjectionBias, QLstmLayer::m_ProjectionParameters, QLstmOptProjectionParameters::m_ProjectionWeights, QLstmBasicParameters::m_RecurrentToCellWeights, QLstmBasicParameters::m_RecurrentToForgetWeights, QLstmOptCifgParameters::m_RecurrentToInputWeights, and QLstmBasicParameters::m_RecurrentToOutputWeights.

82 {
83  auto layer = CloneBase<QLstmLayer>(graph, m_Param, GetName());
84 
85  layer->m_BasicParameters.m_InputToForgetWeights = m_BasicParameters.m_InputToForgetWeights ?
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  layer->m_PeepholeParameters.m_CellToInputWeights = m_PeepholeParameters.m_CellToInputWeights ?
127  }
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  if (!m_Param.m_CifgEnabled) {
138  layer->m_LayerNormParameters.m_InputLayerNormWeights = m_LayerNormParameters.m_InputLayerNormWeights ?
140  }
141 
142  layer->m_LayerNormParameters.m_ForgetLayerNormWeights = m_LayerNormParameters.m_ForgetLayerNormWeights ?
144  layer->m_LayerNormParameters.m_CellLayerNormWeights = m_LayerNormParameters.m_CellLayerNormWeights ?
146  layer->m_LayerNormParameters.m_OutputLayerNormWeights = m_LayerNormParameters.m_OutputLayerNormWeights ?
148  }
149 
150  return std::move(layer);
151 }
QLstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:317
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
Definition: QLstmLayer.hpp:43
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24

◆ CreateWorkload()

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

Makes a workload for the QLstm 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 QLstmLayer.cpp.

References IWorkloadFactory::CreateWorkload(), QLstmLayer::m_BasicParameters, QLstmBasicParameters::m_CellBias, QLstmQueueDescriptor::m_CellBias, QLstmOptLayerNormParameters::m_CellLayerNormWeights, QLstmQueueDescriptor::m_CellLayerNormWeights, QLstmOptPeepholeParameters::m_CellToForgetWeights, QLstmQueueDescriptor::m_CellToForgetWeights, QLstmOptPeepholeParameters::m_CellToInputWeights, QLstmQueueDescriptor::m_CellToInputWeights, QLstmOptPeepholeParameters::m_CellToOutputWeights, QLstmQueueDescriptor::m_CellToOutputWeights, QLstmDescriptor::m_CifgEnabled, QLstmLayer::m_CifgParameters, QLstmBasicParameters::m_ForgetGateBias, QLstmQueueDescriptor::m_ForgetGateBias, QLstmOptLayerNormParameters::m_ForgetLayerNormWeights, QLstmQueueDescriptor::m_ForgetLayerNormWeights, QLstmOptCifgParameters::m_InputGateBias, QLstmQueueDescriptor::m_InputGateBias, QLstmOptLayerNormParameters::m_InputLayerNormWeights, QLstmQueueDescriptor::m_InputLayerNormWeights, QLstmBasicParameters::m_InputToCellWeights, QLstmQueueDescriptor::m_InputToCellWeights, QLstmBasicParameters::m_InputToForgetWeights, QLstmQueueDescriptor::m_InputToForgetWeights, QLstmOptCifgParameters::m_InputToInputWeights, QLstmQueueDescriptor::m_InputToInputWeights, QLstmBasicParameters::m_InputToOutputWeights, QLstmQueueDescriptor::m_InputToOutputWeights, QLstmDescriptor::m_LayerNormEnabled, QLstmLayer::m_LayerNormParameters, QLstmBasicParameters::m_OutputGateBias, QLstmQueueDescriptor::m_OutputGateBias, QLstmOptLayerNormParameters::m_OutputLayerNormWeights, QLstmQueueDescriptor::m_OutputLayerNormWeights, LayerWithParameters< QLstmDescriptor >::m_Param, QLstmDescriptor::m_PeepholeEnabled, QLstmLayer::m_PeepholeParameters, QLstmOptProjectionParameters::m_ProjectionBias, QLstmQueueDescriptor::m_ProjectionBias, QLstmDescriptor::m_ProjectionEnabled, QLstmLayer::m_ProjectionParameters, QLstmOptProjectionParameters::m_ProjectionWeights, QLstmQueueDescriptor::m_ProjectionWeights, QLstmBasicParameters::m_RecurrentToCellWeights, QLstmQueueDescriptor::m_RecurrentToCellWeights, QLstmBasicParameters::m_RecurrentToForgetWeights, QLstmQueueDescriptor::m_RecurrentToForgetWeights, QLstmOptCifgParameters::m_RecurrentToInputWeights, QLstmQueueDescriptor::m_RecurrentToInputWeights, QLstmBasicParameters::m_RecurrentToOutputWeights, QLstmQueueDescriptor::m_RecurrentToOutputWeights, LayerWithParameters< QLstmDescriptor >::PrepInfoAndDesc(), armnn::QLstm, and Layer::SetAdditionalInfo().

23 {
24  QLstmQueueDescriptor 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 
60  descriptor.m_CellToForgetWeights = m_PeepholeParameters.m_CellToForgetWeights.get();
61  descriptor.m_CellToOutputWeights = m_PeepholeParameters.m_CellToOutputWeights.get();
62  }
63 
64  // Layer normalisation parameters
66  {
68  {
69  descriptor.m_InputLayerNormWeights = m_LayerNormParameters.m_InputLayerNormWeights.get();
70  }
71  descriptor.m_ForgetLayerNormWeights = m_LayerNormParameters.m_ForgetLayerNormWeights.get();
72  descriptor.m_CellLayerNormWeights = m_LayerNormParameters.m_CellLayerNormWeights.get();
73  descriptor.m_OutputLayerNormWeights = m_LayerNormParameters.m_OutputLayerNormWeights.get();
74  }
75 
76  SetAdditionalInfo(descriptor);
77 
78  return factory.CreateWorkload(LayerType::QLstm, descriptor, PrepInfoAndDesc(descriptor));
79 }
QLstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
bool m_PeepholeEnabled
Enable/disable peephole.
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
bool m_LayerNormEnabled
Enable/disable layer normalization.
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Definition: Layer.cpp:274
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
bool m_ProjectionEnabled
Enable/disable the projection layer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
Definition: QLstmLayer.hpp:43
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).

◆ ExecuteStrategy()

ARMNN_NO_DEPRECATE_WARN_END void ExecuteStrategy ( IStrategy strategy) const
overridevirtual

Apply a visitor to this layer.

Reimplemented from Layer.

Definition at line 539 of file QLstmLayer.cpp.

References IStrategy::ExecuteStrategy(), Layer::GetName(), LayerWithParameters< QLstmDescriptor >::GetParameters(), ManagedConstTensorHandle::GetTensorInfo(), QLstmLayer::m_BasicParameters, QLstmBasicParameters::m_CellBias, QLstmOptLayerNormParameters::m_CellLayerNormWeights, QLstmOptPeepholeParameters::m_CellToForgetWeights, QLstmOptPeepholeParameters::m_CellToInputWeights, QLstmOptPeepholeParameters::m_CellToOutputWeights, QLstmLayer::m_CifgParameters, QLstmBasicParameters::m_ForgetGateBias, QLstmOptLayerNormParameters::m_ForgetLayerNormWeights, QLstmOptCifgParameters::m_InputGateBias, QLstmOptLayerNormParameters::m_InputLayerNormWeights, QLstmBasicParameters::m_InputToCellWeights, QLstmBasicParameters::m_InputToForgetWeights, QLstmOptCifgParameters::m_InputToInputWeights, QLstmBasicParameters::m_InputToOutputWeights, QLstmLayer::m_LayerNormParameters, QLstmBasicParameters::m_OutputGateBias, QLstmOptLayerNormParameters::m_OutputLayerNormWeights, QLstmLayer::m_PeepholeParameters, QLstmOptProjectionParameters::m_ProjectionBias, QLstmLayer::m_ProjectionParameters, QLstmOptProjectionParameters::m_ProjectionWeights, QLstmBasicParameters::m_RecurrentToCellWeights, QLstmBasicParameters::m_RecurrentToForgetWeights, QLstmOptCifgParameters::m_RecurrentToInputWeights, QLstmBasicParameters::m_RecurrentToOutputWeights, and ManagedConstTensorHandle::Map().

540 {
541  std::vector<ConstTensor> constTensors;
542  ManagedConstTensorHandle managedInputToForgetWeights(m_BasicParameters.m_InputToForgetWeights);
543  ManagedConstTensorHandle managedInputToCellWeights(m_BasicParameters.m_InputToCellWeights);
544  ManagedConstTensorHandle managedInputToOutputWeights(m_BasicParameters.m_InputToOutputWeights);
545  ManagedConstTensorHandle managedRecurrentToForgetWeights(m_BasicParameters.m_RecurrentToForgetWeights);
546  ManagedConstTensorHandle managedRecurrentToCellWeights(m_BasicParameters.m_RecurrentToCellWeights);
547  ManagedConstTensorHandle managedRecurrentToOutputWeights(m_BasicParameters.m_RecurrentToOutputWeights);
548  ManagedConstTensorHandle managedForgetGateBias(m_BasicParameters.m_ForgetGateBias);
549  ManagedConstTensorHandle managedCellBias(m_BasicParameters.m_CellBias);
550  ManagedConstTensorHandle managedOutputGateBias(m_BasicParameters.m_OutputGateBias);
551 
552  // Cifg parameters
553  ManagedConstTensorHandle managedInputToInputWeights(m_CifgParameters.m_InputToInputWeights);
554  ManagedConstTensorHandle managedRecurrentToInputWeights(m_CifgParameters.m_RecurrentToInputWeights);
555  ManagedConstTensorHandle managedInputGateBias(m_CifgParameters.m_InputGateBias);
556 
557  // Projection parameters
558  ManagedConstTensorHandle managedProjectionWeights(m_ProjectionParameters.m_ProjectionWeights);
559  ManagedConstTensorHandle managedProjectionBias(m_ProjectionParameters.m_ProjectionBias);
560 
561  // Peephole parameters
562  ManagedConstTensorHandle managedCellToInputWeights(m_PeepholeParameters.m_CellToInputWeights);
563  ManagedConstTensorHandle managedCellToForgetWeights(m_PeepholeParameters.m_CellToForgetWeights);
564  ManagedConstTensorHandle managedCellToOutputWeights(m_PeepholeParameters.m_CellToOutputWeights);
565 
566  // Layer normalisation parameters
567  ManagedConstTensorHandle managedInputLayerNormWeights(m_LayerNormParameters.m_InputLayerNormWeights);
568  ManagedConstTensorHandle managedForgetLayerNormWeights(m_LayerNormParameters.m_ForgetLayerNormWeights);
569  ManagedConstTensorHandle managedCellLayerNormWeights(m_LayerNormParameters.m_CellLayerNormWeights);
570  ManagedConstTensorHandle managedOutputLayerNormWeights(m_LayerNormParameters.m_OutputLayerNormWeights);
571 
572  // First add mandatory/basic parameters
574  {
575  constTensors.emplace_back(ConstTensor(managedInputToForgetWeights.GetTensorInfo(),
576  managedInputToForgetWeights.Map()));
577  }
579  {
580  constTensors.emplace_back(ConstTensor(managedInputToCellWeights.GetTensorInfo(),
581  managedInputToCellWeights.Map()));
582  }
584  {
585  constTensors.emplace_back(ConstTensor(managedInputToOutputWeights.GetTensorInfo(),
586  managedInputToOutputWeights.Map()));
587  }
589  {
590  constTensors.emplace_back(ConstTensor(
591  managedRecurrentToForgetWeights.GetTensorInfo(),
592  managedRecurrentToForgetWeights.Map()));
593  }
595  {
596  constTensors.emplace_back(ConstTensor(
597  managedRecurrentToCellWeights.GetTensorInfo(),
598  managedRecurrentToCellWeights.Map()));
599  }
601  {
602  constTensors.emplace_back(ConstTensor(
603  managedRecurrentToOutputWeights.GetTensorInfo(),
604  managedRecurrentToOutputWeights.Map()));
605  }
606  if (m_BasicParameters.m_ForgetGateBias != nullptr)
607  {
608  constTensors.emplace_back(ConstTensor(managedForgetGateBias.GetTensorInfo(),
609  managedForgetGateBias.Map()));
610  }
611  if (m_BasicParameters.m_CellBias != nullptr)
612  {
613  constTensors.emplace_back(ConstTensor(managedCellBias.GetTensorInfo(),
614  managedCellBias.Map()));
615  }
616  if (m_BasicParameters.m_OutputGateBias != nullptr)
617  {
618  constTensors.emplace_back(ConstTensor(managedOutputGateBias.GetTensorInfo(),
619  managedOutputGateBias.Map()));
620  }
621 
622  // Add cifig parameters
624  {
625  constTensors.emplace_back(ConstTensor(managedInputToInputWeights.GetTensorInfo(),
626  managedInputToInputWeights.Map()));
627  }
629  {
630  constTensors.emplace_back(ConstTensor(
631  managedRecurrentToInputWeights.GetTensorInfo(),
632  managedRecurrentToInputWeights.Map()));
633  }
634  if (m_CifgParameters.m_InputGateBias != nullptr)
635  {
636  constTensors.emplace_back(ConstTensor(managedInputGateBias.GetTensorInfo(),
637  managedInputGateBias.Map()));
638  }
639 
640  // Add peephole parameters
642  {
643  constTensors.emplace_back(ConstTensor(managedCellToInputWeights.GetTensorInfo(),
644  managedCellToInputWeights.Map()));
645  }
647  {
648  constTensors.emplace_back(ConstTensor(managedCellToForgetWeights.GetTensorInfo(),
649  managedCellToForgetWeights.Map()));
650  }
652  {
653  constTensors.emplace_back(ConstTensor(managedCellToOutputWeights.GetTensorInfo(),
654  managedCellToOutputWeights.Map()));
655  }
656 
657  // Add projection parameters
659  {
660  constTensors.emplace_back(ConstTensor(managedProjectionWeights.GetTensorInfo(),
661  managedProjectionWeights.Map()));
662  }
664  {
665  constTensors.emplace_back(ConstTensor(managedProjectionBias.GetTensorInfo(),
666  managedProjectionBias.Map()));
667  }
668 
669  // Add norm parameters
671  {
672  constTensors.emplace_back(ConstTensor(managedInputLayerNormWeights.GetTensorInfo(),
673  managedInputLayerNormWeights.Map()));
674  }
676  {
677  constTensors.emplace_back(ConstTensor(managedForgetLayerNormWeights.GetTensorInfo(),
678  managedForgetLayerNormWeights.Map()));
679  }
681  {
682  constTensors.emplace_back(ConstTensor(managedCellLayerNormWeights.GetTensorInfo(),
683  managedCellLayerNormWeights.Map()));
684  }
686  {
687  constTensors.emplace_back(ConstTensor(managedOutputLayerNormWeights.GetTensorInfo(),
688  managedOutputLayerNormWeights.Map()));
689  }
690  strategy.ExecuteStrategy(this, GetParameters(), constTensors, GetName());
691 }
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
const QLstmDescriptor & GetParameters() const override
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:317
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
Definition: QLstmLayer.hpp:43
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24

◆ 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 272 of file QLstmLayer.cpp.

References ARMNN_NO_DEPRECATE_WARN_BEGIN, QLstmLayer::m_BasicParameters, QLstmBasicParameters::m_CellBias, QLstmOptLayerNormParameters::m_CellLayerNormWeights, QLstmOptPeepholeParameters::m_CellToForgetWeights, QLstmOptPeepholeParameters::m_CellToInputWeights, QLstmOptPeepholeParameters::m_CellToOutputWeights, QLstmLayer::m_CifgParameters, QLstmBasicParameters::m_ForgetGateBias, QLstmOptLayerNormParameters::m_ForgetLayerNormWeights, QLstmOptCifgParameters::m_InputGateBias, QLstmOptLayerNormParameters::m_InputLayerNormWeights, QLstmBasicParameters::m_InputToCellWeights, QLstmBasicParameters::m_InputToForgetWeights, QLstmOptCifgParameters::m_InputToInputWeights, QLstmBasicParameters::m_InputToOutputWeights, QLstmLayer::m_LayerNormParameters, QLstmBasicParameters::m_OutputGateBias, QLstmOptLayerNormParameters::m_OutputLayerNormWeights, QLstmLayer::m_PeepholeParameters, QLstmOptProjectionParameters::m_ProjectionBias, QLstmLayer::m_ProjectionParameters, QLstmOptProjectionParameters::m_ProjectionWeights, QLstmBasicParameters::m_RecurrentToCellWeights, QLstmBasicParameters::m_RecurrentToForgetWeights, QLstmOptCifgParameters::m_RecurrentToInputWeights, and QLstmBasicParameters::m_RecurrentToOutputWeights.

273 {
274  // For API stability DO NOT ALTER order and add new members to the end of vector
284 
285  // Cifg parameters
289 
290  // Projection parameters
293 
294  // Peephole parameters
298 
299  // Layer normalisation parameters
304 }
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
Definition: QLstmLayer.hpp:43
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24

◆ 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 153 of file QLstmLayer.cpp.

References ARMNN_ASSERT.

Referenced by QLstmInferOutputShapeImpl(), and QLstmLayer::ValidateTensorShapesFromInputs().

154 {
155  ARMNN_ASSERT(inputShapes.size() == 3);
156 
157  // Get input values for validation
158  unsigned int batchSize = inputShapes[0][0];
159  unsigned int outputSize = inputShapes[1][1];
160  unsigned int numUnits = inputShapes[2][1];
161 
162  std::vector<TensorShape> outShapes;
163  outShapes.push_back(TensorShape({ batchSize, outputSize })); // outputStateOut
164  outShapes.push_back(TensorShape({ batchSize, numUnits })); // cellStateOut
165  outShapes.push_back(TensorShape({ batchSize, outputSize })); // output
166 
167  return outShapes;
168 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ ValidateTensorShapesFromInputs()

void ValidateTensorShapesFromInputs ( )
overridevirtual

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

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

Implements Layer.

Definition at line 170 of file QLstmLayer.cpp.

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

171 {
173 
174  const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
175 
177 
178  auto inferredShapes = InferOutputShapes(
179  {
181  GetInputSlot(1).GetConnection()->GetTensorInfo().GetShape(), // previousOutputIn
182  GetInputSlot(2).GetConnection()->GetTensorInfo().GetShape() // previousCellStateIn
183  });
184 
185  ARMNN_ASSERT(inferredShapes.size() == 3);
186 
187  // Check if the weights are nullptr for basic params
189  "QLstmLayer: m_BasicParameters.m_InputToForgetWeights should not be null.");
191  "QLstmLayer: m_BasicParameters.m_InputToCellWeights should not be null.");
193  "QLstmLayer: m_BasicParameters.m_InputToOutputWeights should not be null.");
195  "QLstmLayer: m_BasicParameters.m_RecurrentToForgetWeights should not be null.");
197  "QLstmLayer: m_BasicParameters.m_RecurrentToCellWeights should not be null.");
199  "QLstmLayer: m_BasicParameters.m_RecurrentToOutputWeights should not be null.");
201  "QLstmLayer: m_BasicParameters.m_ForgetGateBias should not be null.");
203  "QLstmLayer: m_BasicParameters.m_CellBias should not be null.");
205  "QLstmLayer: m_BasicParameters.m_OutputGateBias should not be null.");
206 
207  if (!m_Param.m_CifgEnabled)
208  {
210  "QLstmLayer: m_CifgParameters.m_InputToInputWeights should not be null.");
212  "QLstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not be null.");
214  "QLstmLayer: m_CifgParameters.m_InputGateBias should not be null.");
215 
216  ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "QLstmLayer");
217  }
218  else
219  {
221  "QLstmLayer: m_CifgParameters.m_InputToInputWeights should not have a value when CIFG is enabled.");
223  "QLstmLayer: m_CifgParameters.m_RecurrentToInputWeights should "
224  "not have a value when CIFG is enabled.");
226  "QLstmLayer: m_CifgParameters.m_InputGateBias should not have a value when CIFG is enabled.");
227 
228  ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "QLstmLayer");
229  }
230 
232  {
234  "QLstmLayer: m_ProjectionParameters.m_ProjectionWeights should not be null.");
235  }
236 
238  {
239  if (!m_Param.m_CifgEnabled) {
241  "QLstmLayer: m_PeepholeParameters.m_CellToInputWeights should not be null "
242  "when Peephole is enabled and CIFG is disabled.");
243  }
244 
246  "QLstmLayer: m_PeepholeParameters.m_CellToForgetWeights should not be null.");
248  "QLstmLayer: m_PeepholeParameters.m_CellToOutputWeights should not be null.");
249  }
250 
252  GetOutputSlot(1).GetTensorInfo().GetShape(), inferredShapes[1], m_ShapeInferenceMethod, "QLstmLayer", 1);
254  GetOutputSlot(2).GetTensorInfo().GetShape(), inferredShapes[2], m_ShapeInferenceMethod, "QLstmLayer", 2);
255 
257  {
259  {
261  "QLstmLayer: m_LayerNormParameters.m_InputLayerNormWeights should not be null.");
262  }
264  "QLstmLayer: m_LayerNormParameters.m_ForgetLayerNormWeights should not be null.");
266  "QLstmLayer: m_LayerNormParameters.m_CellLayerNormWeights should not be null.");
268  "QLstmLayer: m_LayerNormParameters.m_UutputLayerNormWeights should not be null.");
269  }
270 }
QLstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
QLstmOptProjectionParameters m_ProjectionParameters
Definition: QLstmLayer.hpp:85
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:35
bool m_PeepholeEnabled
Enable/disable peephole.
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:61
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:71
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:21
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:69
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Definition: Layer.cpp:491
const IOutputSlot * GetConnection() const override
Definition: Layer.hpp:204
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:53
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
Definition: Layer.cpp:422
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:19
QLstmOptLayerNormParameters m_LayerNormParameters
Definition: QLstmLayer.hpp:87
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:33
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:41
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
Definition: Layer.cpp:378
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:17
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:322
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
Definition: QLstmLayer.hpp:63
bool m_LayerNormEnabled
Enable/disable layer normalization.
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:73
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
Definition: QLstmLayer.hpp:31
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:49
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:51
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
Definition: QLstmLayer.hpp:75
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:26
QLstmBasicParameters m_BasicParameters
Definition: QLstmLayer.hpp:83
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:28
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8)...
Definition: QLstmLayer.hpp:59
bool m_ProjectionEnabled
Enable/disable the projection layer.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:324
virtual const TensorInfo & GetTensorInfo() const =0
QLstmOptCifgParameters m_CifgParameters
Definition: QLstmLayer.hpp:84
QLstmOptPeepholeParameters m_PeepholeParameters
Definition: QLstmLayer.hpp:86
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: QLstmLayer.cpp:153
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
Definition: QLstmLayer.hpp:24
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
const TensorInfo & GetTensorInfo() const override
Definition: Layer.cpp:92
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
ShapeInferenceMethod m_ShapeInferenceMethod
Definition: Layer.hpp:421

Member Data Documentation

◆ m_BasicParameters

◆ m_CifgParameters

◆ m_LayerNormParameters

◆ m_PeepholeParameters

◆ m_ProjectionParameters


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