24.08
|
Go to the documentation of this file.
150 return std::move(layer);
155 if (inputShapes.size() != 3)
157 throw armnn::Exception(
"inputShapes' size is \"" + std::to_string(inputShapes.size()) +
158 "\" - should be \"3\".");
162 unsigned int batchSize = inputShapes[0][0];
163 unsigned int outputSize = inputShapes[1][1];
164 unsigned int numUnits = inputShapes[2][1];
166 std::vector<TensorShape> outShapes;
167 outShapes.push_back(
TensorShape({ batchSize, outputSize }));
168 outShapes.push_back(
TensorShape({ batchSize, numUnits }));
169 outShapes.push_back(
TensorShape({ batchSize, outputSize }));
189 if (inferredShapes.size() != 3)
192 + std::to_string(inferredShapes.size()) +
193 " element(s) - should only have 3.");
200 "m_BasicParameters.m_InputToForgetWeights should not be null.");
206 "m_BasicParameters.m_InputToCellWeights should not be null.");
212 "m_BasicParameters.m_InputToOutputWeights should not be null.");
218 "m_BasicParameters.m_RecurrentToForgetWeights should not be null.");
224 "m_BasicParameters.m_RecurrentToCellWeights should not be null.");
230 "m_BasicParameters.m_RecurrentToOutputWeights should not be null.");
236 "m_BasicParameters.m_ForgetGateBias should not be null.");
242 "m_BasicParameters.m_CellBias should not be null.");
248 "m_BasicParameters.m_OutputGateBias should not be null.");
256 "m_CifgParameters.m_InputToInputWeights should not be null.");
262 "m_CifgParameters.m_RecurrentToInputWeights should not be null.");
268 "m_CifgParameters.m_InputGateBias should not be null.");
278 "m_CifgParameters.m_InputToInputWeights "
279 "should not have a value when CIFG is enabled.");
285 "m_CifgParameters.m_RecurrentToInputWeights "
286 "should not have a value when CIFG is enabled.");
292 "m_CifgParameters.m_InputGateBias "
293 "should not have a value when CIFG is enabled.");
304 "m_ProjectionParameters.m_ProjectionWeights should not be null.");
314 "m_PeepholeParameters.m_CellToInputWeights should not be null "
315 "when Peephole is enabled and CIFG is disabled.");
322 "m_PeepholeParameters.m_CellToForgetWeights should not be null.");
328 "m_PeepholeParameters.m_CellToOutputWeights should not be null.");
344 "should not be null.");
351 "m_LayerNormParameters.m_ForgetLayerNormWeights should not be null.");
357 "m_LayerNormParameters.m_CellLayerNormWeights should not be null.");
363 "m_LayerNormParameters.m_UutputLayerNormWeights should not be null.");
405 std::vector<ConstTensor> constTensors;
440 managedInputToForgetWeights.
Map()));
445 managedInputToCellWeights.
Map()));
450 managedInputToOutputWeights.
Map()));
456 managedRecurrentToForgetWeights.
Map()));
462 managedRecurrentToCellWeights.
Map()));
468 managedRecurrentToOutputWeights.
Map()));
473 managedForgetGateBias.
Map()));
478 managedCellBias.
Map()));
483 managedOutputGateBias.
Map()));
490 managedInputToInputWeights.
Map()));
496 managedRecurrentToInputWeights.
Map()));
501 managedInputGateBias.
Map()));
508 managedCellToInputWeights.
Map()));
513 managedCellToForgetWeights.
Map()));
518 managedCellToOutputWeights.
Map()));
525 managedProjectionWeights.
Map()));
530 managedProjectionBias.
Map()));
537 managedInputLayerNormWeights.
Map()));
542 managedForgetLayerNormWeights.
Map()));
547 managedCellLayerNormWeights.
Map()));
552 managedOutputLayerNormWeights.
Map()));
QLstmOptCifgParameters m_CifgParameters
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
A QLstmDescriptor for the QLstmLayer.
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32).
bool m_ProjectionEnabled
Enable/disable the projection layer.
This layer represents a QLstm operation.
const TensorInfo & GetTensorInfo() const override
const ConstTensorHandle * m_InputToForgetWeights
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
const ConstTensorHandle * m_InputLayerNormWeights
QLstmLayer(const QLstmDescriptor ¶m, const char *name)
Constructor to create a QLstmLayer.
QLstmLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const ConstTensorHandle * m_InputToInputWeights
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const QLstmDescriptor & GetParameters() const override
const ConstTensorHandle * m_ProjectionWeights
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units] (QSymmS8).
const ConstTensorHandle * m_ForgetLayerNormWeights
const char * GetName() const override
Returns the name of the layer.
const ConstTensorHandle * m_RecurrentToOutputWeights
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
const ConstTensorHandle * m_CellToOutputWeights
QLstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const ConstTensorHandle * m_CellToForgetWeights
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the QLstm type.
const ConstTensorHandle * m_OutputLayerNormWeights
const ConstTensorHandle * m_InputGateBias
const ConstTensorHandle * m_OutputGateBias
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8).
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
const ConstTensorHandle * m_ForgetGateBias
void SetAdditionalInfo(QueueDescriptor &descriptor) const
Base class for all ArmNN exceptions so that users can filter to just those.
const ConstTensorHandle * m_RecurrentToInputWeights
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units] (int32).
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
const ConstTensorHandle * m_RecurrentToForgetWeights
Layer::ImmutableConstantTensors GetConstantTensorsByRef() const override
Retrieve the handles to the constant values stored by the layer.
QLstmOptLayerNormParameters m_LayerNormParameters
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8).
const ConstTensorHandle * m_InputToOutputWeights
QLstmOptPeepholeParameters m_PeepholeParameters
const TensorShape & GetShape() const
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32).
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32).
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8).
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units] (QSymmS8).
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of QLstmLayer.
Copyright (c) 2021 ARM Limited and Contributors.
QLstmOptProjectionParameters m_ProjectionParameters
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs,...
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8).
const ConstTensorHandle * m_ProjectionBias
const ConstTensorHandle * m_CellToInputWeights
bool m_LayerNormEnabled
Enable/disable layer normalization.
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size] (int32).
const ConstTensorHandle * m_CellBias
QLstmBasicParameters m_BasicParameters
const ConstTensorHandle * m_InputToCellWeights
ShapeInferenceMethod m_ShapeInferenceMethod
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).
bool m_PeepholeEnabled
Enable/disable peephole.
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const =0
Backends should implement their own CreateWorkload function with a switch statement.
virtual void ExecuteStrategy(const IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
const ConstTensorHandle * m_CellLayerNormWeights
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).
const ConstTensorHandle * m_RecurrentToCellWeights
const TensorInfo & GetTensorInfo() const
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8).