24.08
|
Go to the documentation of this file.
49 auto layer = CloneBase<QuantizedLstmLayer>(graph,
GetName());
78 return std::move(layer);
83 if (inputShapes.size() != 3)
85 throw armnn::Exception(
"inputShapes' size is \"" + std::to_string(inputShapes.size()) +
86 "\" - should be \"3\".");
90 unsigned int numBatches = inputShapes[0][0];
91 unsigned int outputSize = inputShapes[1][1];
93 std::vector<TensorShape> outShapes;
94 outShapes.push_back(
TensorShape({numBatches, outputSize}));
95 outShapes.push_back(
TensorShape({numBatches, outputSize}));
115 if (inferredShapes.size() != 2)
118 + std::to_string(inferredShapes.size()) +
119 " element(s) - should only have 2.");
126 "m_QuantizedLstmParameters.m_InputToInputWeights "
127 "should not be null.");
133 "m_QuantizedLstmParameters.m_InputToForgetWeights "
134 "should not be null.");
140 "m_QuantizedLstmParameters.m_InputToCellWeights "
141 "should not be null.");
147 "m_QuantizedLstmParameters.m_InputToOutputWeights "
148 "should not be null.");
154 "m_QuantizedLstmParameters.m_RecurrentToInputWeights "
155 "should not be null.");
161 "m_QuantizedLstmParameters.m_RecurrentToForgetWeights "
162 "should not be null.");
168 "m_QuantizedLstmParameters.m_RecurrentToCellWeights "
169 "should not be null.");
175 "m_QuantizedLstmParameters.m_RecurrentToOutputWeights "
176 "should not be null.");
182 "m_QuantizedLstmParameters.m_InputGateBias "
183 "should not be null.");
189 "m_QuantizedLstmParameters.m_ForgetGateBias "
190 "should not be null.");
196 "m_QuantizedLstmParameters.m_CellBias "
197 "should not be null.");
203 "m_QuantizedLstmParameters.m_OutputGateBias "
204 "should not be null.");
213 "QuantizedLstmLayer",
241 std::vector<ConstTensor> constTensors;
262 managedInputToInputWeights.
Map()));
268 managedInputToForgetWeights.
Map()));
274 managedInputToCellWeights.
Map()));
280 managedInputToOutputWeights.
Map()));
288 managedRecurrentToInputWeights.
Map()));
295 managedRecurrentToForgetWeights.
Map()));
302 managedRecurrentToCellWeights.
Map()));
309 managedRecurrentToOutputWeights.
Map()));
316 managedInputGateBias.
Map()));
322 managedForgetGateBias.
Map()));
328 managedCellBias.
Map()));
334 managedOutputGateBias.
Map()));
const ConstTensorHandle * m_CellBias
std::shared_ptr< ConstTensorHandle > m_InputToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
const ConstTensorHandle * m_RecurrentToInputWeights
std::shared_ptr< ConstTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [outputSize] (int32).
const ConstTensorHandle * m_InputToForgetWeights
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of QuantizedLstmLayer.
const TensorInfo & GetTensorInfo() const override
Layer::ImmutableConstantTensors GetConstantTensorsByRef() const override
Retrieve the handles to the constant values stored by the layer.
QuantizedLstmLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
std::shared_ptr< ConstTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [outputSize] (int32).
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const ConstTensorHandle * m_RecurrentToOutputWeights
const ConstTensorHandle * m_InputGateBias
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const char * GetName() const override
Returns the name of the layer.
std::shared_ptr< ConstTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, outputSize] (QAsymm8).
std::shared_ptr< ConstTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
std::vector< std::reference_wrapper< const std::shared_ptr< ConstTensorHandle > >> ImmutableConstantTensors
std::shared_ptr< ConstTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
const ConstTensorHandle * m_RecurrentToCellWeights
const ConstTensorHandle * m_InputToInputWeights
std::shared_ptr< ConstTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [outputSize] (int32).
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *Layer::CreateWorkload.
std::shared_ptr< ConstTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, inputSize] (QAsymm8).
const ConstTensorHandle * m_RecurrentToForgetWeights
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_InputToCellWeights
Base class for all ArmNN exceptions so that users can filter to just those.
This layer represents a QuantizedLstm operation.
Base class for all descriptors.
const ConstTensorHandle * m_InputToOutputWeights
QuantizedLstmParameters m_QuantizedLstmParameters
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the QuantizedLstm type.
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,...
const TensorShape & GetShape() const
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
Copyright (c) 2021 ARM Limited and Contributors.
std::shared_ptr< ConstTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, outputSize] (QAsymm8).
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_InputGateBias
A unique pointer to represent 1D bias tensor with dimensions [outputSize] (int32).
ShapeInferenceMethod m_ShapeInferenceMethod
QuantizedLstmLayer(const char *name)
Constructor to create a QuantizedLstmLayer.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
const ConstTensorHandle * m_OutputGateBias
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_RecurrentToInputWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, outputSize] (QAsymm8).
std::shared_ptr< ConstTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [outputSize, outputSize] (QAsymm8).
const TensorInfo & GetTensorInfo() const
const ConstTensorHandle * m_ForgetGateBias