24.02
|
Go to the documentation of this file.
82 auto layer = CloneBase<UnidirectionalSequenceLstmLayer>(graph,
m_Param,
GetName());
147 return std::move(layer);
151 const std::vector<TensorShape>& inputShapes)
const
156 unsigned int outputSize = inputShapes[1][1];
158 std::vector<TensorShape> outShapes;
161 outShapes.push_back(
TensorShape({inputShapes[0][0], inputShapes[0][1], outputSize}));
165 outShapes.push_back(
TensorShape({inputShapes[0][0], inputShapes[0][1], outputSize}));
188 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToForgetWeights should not be null.");
190 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToCellWeights should not be null.");
192 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_InputToOutputWeights should not be null.");
194 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToForgetWeights "
195 "should not be null.");
197 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToCellWeights should not be null.");
199 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_RecurrentToOutputWeights "
200 "should not be null.");
202 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_ForgetGateBias should not be null.");
204 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_CellBias should not be null.");
206 "UnidirectionalSequenceLstmLayer: m_BasicParameters.m_OutputGateBias should not be null.");
211 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputToInputWeights should not be null.");
213 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_RecurrentToInputWeights "
214 "should not be null.");
216 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputGateBias should not be null.");
221 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputToInputWeights should not have a value "
222 "when CIFG is enabled.");
224 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_RecurrentToInputWeights should not have a value "
225 "when CIFG is enabled.");
227 "UnidirectionalSequenceLstmLayer: m_CifgParameters.m_InputGateBias should not have a value "
228 "when CIFG is enabled.");
234 "UnidirectionalSequenceLstmLayer: m_ProjectionParameters.m_ProjectionWeights "
235 "should not be null.");
243 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToInputWeights "
244 "should not be null "
245 "when Peephole is enabled and CIFG is disabled.");
248 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToForgetWeights "
249 "should not be null.");
251 "UnidirectionalSequenceLstmLayer: m_PeepholeParameters.m_CellToOutputWeights "
252 "should not be null.");
260 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_inputLayerNormWeights "
261 "should not be null.");
264 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_forgetLayerNormWeights "
265 "should not be null.");
267 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_cellLayerNormWeights "
268 "should not be null.");
270 "UnidirectionalSequenceLstmLayer: m_LayerNormParameters.m_outputLayerNormWeights "
271 "should not be null.");
313 std::vector<ConstTensor> constTensors;
351 managedInputToForgetWeights.
Map()));
356 managedInputToCellWeights.
Map()));
361 managedInputToOutputWeights.
Map()));
367 managedRecurrentToForgetWeights.
Map()));
373 managedRecurrentToCellWeights.
Map()));
379 managedRecurrentToOutputWeights.
Map()));
384 managedForgetGateBias.
Map()));
389 managedCellBias.
Map()));
394 managedOutputGateBias.
Map()));
403 managedInputToInputWeights.
Map()));
409 managedRecurrentToInputWeights.
Map()));
414 managedInputGateBias.
Map()));
426 managedCellToInputWeights.
Map()));
432 managedCellToForgetWeights.
Map()));
437 managedCellToOutputWeights.
Map()));
447 managedProjectionWeights.
Map()));
452 managedProjectionBias.
Map()));
464 managedInputLayerNormWeights.
Map()));
470 managedForgetLayerNormWeights.
Map()));
475 managedCellLayerNormWeights.
Map()));
480 managedOutputLayerNormWeights.
Map()));
#define ARMNN_ASSERT(COND)
UnidirectionalSequenceLstmLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
const ConstTensorHandle * m_CellBias
const ConstTensorHandle * m_RecurrentToCellWeights
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].
bool m_TimeMajor
Enable/disable time major.
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].
std::shared_ptr< ConstTensorHandle > m_InputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the UnidirectionalSequence LSTM type.
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)
LstmBasicParameters m_BasicParameters
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Layer::ImmutableConstantTensors GetConstantTensorsByRef() const override
Retrieve the handles to the constant values stored by the layer.
const ConstTensorHandle * m_InputLayerNormWeights
const ConstTensorHandle * m_InputToOutputWeights
const ConstTensorHandle * m_OutputLayerNormWeights
#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].
const ConstTensorHandle * m_OutputGateBias
const ConstTensorHandle * m_ForgetLayerNormWeights
const char * GetName() const override
Returns the name of the layer.
const ConstTensorHandle * m_InputToForgetWeights
const ConstTensorHandle * m_RecurrentToOutputWeights
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].
const ConstTensorHandle * m_ProjectionWeights
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.).
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 ConstTensorHandle * m_ForgetGateBias
const ConstTensorHandle * m_InputGateBias
const void * Map(bool blocking=true)
RAII Managed resource Unmaps MemoryArea once out of scope.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
const ConstTensorHandle * m_CellToInputWeights
UnidirectionalSequenceLstmLayer(const LstmDescriptor ¶m, const char *name)
Constructor to create a UnidirectionalSequenceLstmLayer.
const ConstTensorHandle * m_CellToOutputWeights
LstmOptPeepholeParameters m_PeepholeParameters
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].
This layer represents a LSTM operation.
const ConstTensorHandle * m_RecurrentToForgetWeights
const ConstTensorHandle * m_CellToForgetWeights
const ConstTensorHandle * m_RecurrentToInputWeights
const ConstTensorHandle * m_InputToInputWeights
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
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).
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
const TensorShape & GetShape() const
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_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
bool m_LayerNormEnabled
Enable/disable layer normalization.
const ConstTensorHandle * m_ProjectionBias
@ UnidirectionalSequenceLstm
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.
LstmOptLayerNormParameters m_LayerNormParameters
std::shared_ptr< ConstTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
LstmOptCifgParameters m_CifgParameters
bool m_ProjectionEnabled
Enable/disable the projection layer.
const ConstTensorHandle * m_InputToCellWeights
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
ShapeInferenceMethod m_ShapeInferenceMethod
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
const ConstTensorHandle * m_CellLayerNormWeights
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of UnidirectionalSequenceLstmLa...
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
LstmOptProjectionParameters m_ProjectionParameters