24.02
|
Go to the documentation of this file.
147 return std::move(layer);
155 unsigned int batchSize = inputShapes[0][0];
156 unsigned int outputSize = inputShapes[1][1];
157 unsigned int numUnits = inputShapes[2][1];
159 std::vector<TensorShape> outShapes;
161 outShapes.push_back(
TensorShape({batchSize, outputSize}));
162 outShapes.push_back(
TensorShape({batchSize, numUnits}));
163 outShapes.push_back(
TensorShape({batchSize, outputSize}));
186 "LstmLayer: m_BasicParameters.m_InputToForgetWeights should not be null.");
188 "LstmLayer: m_BasicParameters.m_InputToCellWeights should not be null.");
190 "LstmLayer: m_BasicParameters.m_InputToOutputWeights should not be null.");
192 "LstmLayer: m_BasicParameters.m_RecurrentToForgetWeights should not be null.");
194 "LstmLayer: m_BasicParameters.m_RecurrentToCellWeights should not be null.");
196 "LstmLayer: m_BasicParameters.m_RecurrentToOutputWeights should not be null.");
198 "LstmLayer: m_BasicParameters.m_ForgetGateBias should not be null.");
200 "LstmLayer: m_BasicParameters.m_CellBias should not be null.");
202 "LstmLayer: m_BasicParameters.m_OutputGateBias should not be null.");
207 "LstmLayer: m_CifgParameters.m_InputToInputWeights should not be null.");
209 "LstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not be null.");
211 "LstmLayer: m_CifgParameters.m_InputGateBias should not be null.");
218 "LstmLayer: m_CifgParameters.m_InputToInputWeights should not have a value when CIFG is enabled.");
220 "LstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not have a value when CIFG is enabled.");
222 "LstmLayer: m_CifgParameters.m_InputGateBias should not have a value when CIFG is enabled.");
230 "LstmLayer: m_ProjectionParameters.m_ProjectionWeights should not be null.");
238 "LstmLayer: m_PeepholeParameters.m_CellToInputWeights should not be null "
239 "when Peephole is enabled and CIFG is disabled.");
242 "LstmLayer: m_PeepholeParameters.m_CellToForgetWeights should not be null.");
244 "LstmLayer: m_PeepholeParameters.m_CellToOutputWeights should not be null.");
259 "LstmLayer: m_LayerNormParameters.m_inputLayerNormWeights should not be null.");
262 "LstmLayer: m_LayerNormParameters.m_forgetLayerNormWeights should not be null.");
264 "LstmLayer: m_LayerNormParameters.m_cellLayerNormWeights should not be null.");
266 "LstmLayer: m_LayerNormParameters.m_outputLayerNormWeights should not be null.");
306 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()));
396 managedInputToInputWeights.
Map()));
402 managedRecurrentToInputWeights.
Map()));
407 managedInputGateBias.
Map()));
419 managedCellToInputWeights.
Map()));
425 managedCellToForgetWeights.
Map()));
430 managedCellToOutputWeights.
Map()));
440 managedProjectionWeights.
Map()));
445 managedProjectionBias.
Map()));
457 managedInputLayerNormWeights.
Map()));
463 managedForgetLayerNormWeights.
Map()));
468 managedCellLayerNormWeights.
Map()));
473 managedOutputLayerNormWeights.
Map()));
#define ARMNN_ASSERT(COND)
const ConstTensorHandle * m_ForgetLayerNormWeights
const ConstTensorHandle * m_CellBias
LstmOptProjectionParameters m_ProjectionParameters
std::shared_ptr< ConstTensorHandle > m_ProjectionWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const TensorInfo & GetTensorInfo() const override
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
LstmLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const ConstTensorHandle * m_InputToInputWeights
const ConstTensorHandle * m_ForgetGateBias
LstmOptLayerNormParameters m_LayerNormParameters
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
const ConstTensorHandle * m_InputToForgetWeights
std::shared_ptr< ConstTensorHandle > m_InputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellToInputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
Layer::ImmutableConstantTensors GetConstantTensorsByRef() const override
Retrieve the handles to the constant values stored by the layer.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const ConstTensorHandle * m_InputToCellWeights
#define ARMNN_ASSERT_MSG(COND, MSG)
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const LstmDescriptor & GetParameters() const override
std::shared_ptr< ConstTensorHandle > m_ProjectionBias
A unique pointer to represent 1D weights tensor with dimensions [output_size].
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
LstmOptCifgParameters m_CifgParameters
const ConstTensorHandle * m_CellToOutputWeights
const char * GetName() const override
Returns the name of the layer.
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
bool m_PeepholeEnabled
Enable/disable peephole.
LstmDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
This layer represents a LSTM operation.
std::shared_ptr< ConstTensorHandle > m_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
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.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
const ConstTensorHandle * m_InputGateBias
const ConstTensorHandle * m_RecurrentToCellWeights
const ConstTensorHandle * m_CellLayerNormWeights
LstmLayer(const LstmDescriptor ¶m, const char *name)
Constructor to create a LstmLayer.
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
LstmBasicParameters m_BasicParameters
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
An LstmDescriptor for the LstmLayer.
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
const ConstTensorHandle * m_RecurrentToOutputWeights
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
By default returns inputShapes if the number of inputs are equal to number of outputs,...
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
const TensorShape & GetShape() const
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
const ConstTensorHandle * m_InputLayerNormWeights
bool m_LayerNormEnabled
Enable/disable layer normalization.
const ConstTensorHandle * m_RecurrentToForgetWeights
const ConstTensorHandle * m_CellToInputWeights
const ConstTensorHandle * m_ProjectionWeights
std::shared_ptr< ConstTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
Copyright (c) 2021 ARM Limited and Contributors.
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const ConstTensorHandle * m_RecurrentToInputWeights
bool m_ProjectionEnabled
Enable/disable the projection layer.
const ConstTensorHandle * m_ProjectionBias
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
const ConstTensorHandle * m_OutputGateBias
LstmOptPeepholeParameters m_PeepholeParameters
const ConstTensorHandle * m_CellToForgetWeights
const ConstTensorHandle * m_InputToOutputWeights
const ConstTensorHandle * m_OutputLayerNormWeights
ShapeInferenceMethod m_ShapeInferenceMethod
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of LstmLayer.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
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
std::shared_ptr< ConstTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
const TensorInfo & GetTensorInfo() const
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the LSTM type.