24.02
|
Go to the documentation of this file.
150 return std::move(layer);
158 unsigned int batchSize = inputShapes[0][0];
159 unsigned int outputSize = inputShapes[1][1];
160 unsigned int numUnits = inputShapes[2][1];
162 std::vector<TensorShape> outShapes;
163 outShapes.push_back(
TensorShape({ batchSize, outputSize }));
164 outShapes.push_back(
TensorShape({ batchSize, numUnits }));
165 outShapes.push_back(
TensorShape({ batchSize, outputSize }));
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.");
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.");
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.");
234 "QLstmLayer: m_ProjectionParameters.m_ProjectionWeights should not be null.");
241 "QLstmLayer: m_PeepholeParameters.m_CellToInputWeights should not be null "
242 "when Peephole is enabled and CIFG is disabled.");
246 "QLstmLayer: m_PeepholeParameters.m_CellToForgetWeights should not be null.");
248 "QLstmLayer: m_PeepholeParameters.m_CellToOutputWeights should not be null.");
261 "QLstmLayer: m_LayerNormParameters.m_InputLayerNormWeights should not be null.");
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.");
309 std::vector<ConstTensor> constTensors;
344 managedInputToForgetWeights.
Map()));
349 managedInputToCellWeights.
Map()));
354 managedInputToOutputWeights.
Map()));
360 managedRecurrentToForgetWeights.
Map()));
366 managedRecurrentToCellWeights.
Map()));
372 managedRecurrentToOutputWeights.
Map()));
377 managedForgetGateBias.
Map()));
382 managedCellBias.
Map()));
387 managedOutputGateBias.
Map()));
394 managedInputToInputWeights.
Map()));
400 managedRecurrentToInputWeights.
Map()));
405 managedInputGateBias.
Map()));
412 managedCellToInputWeights.
Map()));
417 managedCellToForgetWeights.
Map()));
422 managedCellToOutputWeights.
Map()));
429 managedProjectionWeights.
Map()));
434 managedProjectionBias.
Map()));
441 managedInputLayerNormWeights.
Map()));
446 managedForgetLayerNormWeights.
Map()));
451 managedCellLayerNormWeights.
Map()));
456 managedOutputLayerNormWeights.
Map()));
#define ARMNN_ASSERT(COND)
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
#define ARMNN_ASSERT_MSG(COND, MSG)
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
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).