ArmNN
 25.11
Loading...
Searching...
No Matches
QuantizedLstmLayer Class Reference

This layer represents a QuantizedLstm operation. More...

#include <QuantizedLstmLayer.hpp>

Inheritance diagram for QuantizedLstmLayer:
[legend]
Collaboration diagram for QuantizedLstmLayer:
[legend]

Public Member Functions

virtual std::unique_ptr< IWorkloadCreateWorkload (const IWorkloadFactory &factory) const override
 Makes a workload for the QuantizedLstm type.
QuantizedLstmLayerClone (Graph &graph) const override
 Creates a dynamically-allocated copy of this layer.
void ValidateTensorShapesFromInputs () override
 Check if the input tensor shape(s) will lead to a valid configuration of QuantizedLstmLayer.
std::vector< TensorShapeInferOutputShapes (const std::vector< TensorShape > &inputShapes) const override
 By default returns inputShapes if the number of inputs are equal to number of outputs, otherwise infers the output shapes from given input shapes and layer properties.
void ExecuteStrategy (IStrategy &strategy) const override
 Apply a visitor to this layer.
Public Member Functions inherited from Layer
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, const char *name)
 Layer (unsigned int numInputSlots, unsigned int numOutputSlots, LayerType type, DataLayout layout, const char *name)
const std::string & GetNameStr () const
const OutputHandlerGetOutputHandler (unsigned int i=0) const
OutputHandlerGetOutputHandler (unsigned int i=0)
ShapeInferenceMethod GetShapeInferenceMethod () const
bool GetAllowExpandedDims () const
const std::vector< InputSlot > & GetInputSlots () const
const std::vector< OutputSlot > & GetOutputSlots () const
std::vector< InputSlot >::iterator BeginInputSlots ()
std::vector< InputSlot >::iterator EndInputSlots ()
std::vector< OutputSlot >::iterator BeginOutputSlots ()
std::vector< OutputSlot >::iterator EndOutputSlots ()
bool IsOutputUnconnected ()
void ResetPriority () const
LayerPriority GetPriority () const
LayerType GetType () const override
 Returns the armnn::LayerType of this layer.
DataType GetDataType () const
const BackendIdGetBackendId () const
void SetBackendId (const BackendId &id) override
 Set the backend of the IConnectableLayer.
virtual void CreateTensorHandles (const TensorHandleFactoryRegistry &registry, const IWorkloadFactory &factory, const bool IsMemoryManaged=true)
void VerifyLayerConnections (unsigned int expectedConnections, const CheckLocation &location) const
virtual void SerializeLayerParameters (ParameterStringifyFunction &fn) const
 Helper to serialize the layer parameters to string.
virtual void ReleaseConstantData ()
template<typename Op>
void OperateOnConstantTensors (Op op)
const char * GetName () const override
 Returns the name of the layer.
unsigned int GetNumInputSlots () const override
 Returns the number of connectable input slots.
unsigned int GetNumOutputSlots () const override
 Returns the number of connectable output slots.
const InputSlotGetInputSlot (unsigned int index) const override
 Get a const input slot handle by slot index.
InputSlotGetInputSlot (unsigned int index) override
 Get the input slot handle by slot index.
const OutputSlotGetOutputSlot (unsigned int index=0) const override
 Get the const output slot handle by slot index.
OutputSlotGetOutputSlot (unsigned int index=0) override
 Get the output slot handle by slot index.
void SetGuid (LayerGuid guid)
LayerGuid GetGuid () const final
 Returns the unique id of the layer.
void AddRelatedLayerName (const std::string layerName)
const std::list< std::string > & GetRelatedLayerNames ()
virtual void Reparent (Graph &dest, std::list< Layer * >::const_iterator iterator)=0
void BackendSelectionHint (Optional< BackendId > backend) final
 Provide a hint for the optimizer as to which backend to prefer for this layer.
Optional< BackendIdGetBackendHint () const
void SetShapeInferenceMethod (ShapeInferenceMethod shapeInferenceMethod)
void SetAllowExpandedDims (bool allowExpandedDims)
template<typename T>
std::shared_ptr< T > GetAdditionalInformation () const
void SetAdditionalInfoForObject (const AdditionalInfoObjectPtr &additionalInfo)
virtual const BaseDescriptorGetParameters () const override
 If the layer has a descriptor return it.

Public Attributes

QuantizedLstmParameters m_QuantizedLstmParameters

Protected Member Functions

 QuantizedLstmLayer (const char *name)
 Constructor to create a QuantizedLstmLayer.
 ~QuantizedLstmLayer ()=default
 Default destructor.
Layer::ImmutableConstantTensors GetConstantTensorsByRef () const override
 Retrieve the handles to the constant values stored by the layer.
Protected Member Functions inherited from Layer
virtual ~Layer ()=default
template<typename QueueDescriptor>
void CollectQueueDescriptorInputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
template<typename QueueDescriptor>
void CollectQueueDescriptorOutputs (QueueDescriptor &descriptor, WorkloadInfo &info) const
void ValidateAndCopyShape (const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
void VerifyShapeInferenceType (const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
template<typename QueueDescriptor>
WorkloadInfo PrepInfoAndDesc (QueueDescriptor &descriptor) const
 Helper function to reduce duplication in *LayerCreateWorkload.
template<typename LayerType, typename ... Params>
LayerTypeCloneBase (Graph &graph, Params &&... params) const
virtual ConstantTensors GetConstantTensorsByRef () override final
void SetAdditionalInfo (QueueDescriptor &descriptor) const
Protected Member Functions inherited from IConnectableLayer
 ~IConnectableLayer ()
 Objects are not deletable via the handle.

Additional Inherited Members

Public Types inherited from IConnectableLayer
using ConstantTensors = std::vector<std::reference_wrapper<std::shared_ptr<ConstTensorHandle>>>
using ImmutableConstantTensors = std::vector<std::reference_wrapper<const std::shared_ptr<ConstTensorHandle>>>
Protected Attributes inherited from Layer
AdditionalInfoObjectPtr m_AdditionalInfoObject
std::vector< OutputHandlerm_OutputHandlers
ShapeInferenceMethod m_ShapeInferenceMethod

Detailed Description

This layer represents a QuantizedLstm operation.

Definition at line 45 of file QuantizedLstmLayer.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmLayer()

QuantizedLstmLayer ( const char * name)
protected

Constructor to create a QuantizedLstmLayer.

Parameters
[in]nameOptional name for the layer.

Definition at line 17 of file QuantizedLstmLayer.cpp.

18 : Layer(3, 2, LayerType::QuantizedLstm, name)
19{
20}

References Layer::Layer(), and armnn::QuantizedLstm.

Referenced by Clone().

◆ ~QuantizedLstmLayer()

~QuantizedLstmLayer ( )
protecteddefault

Default destructor.

Member Function Documentation

◆ Clone()

QuantizedLstmLayer * Clone ( Graph & graph) const
overridevirtual

Creates a dynamically-allocated copy of this layer.

Parameters
[in]graphThe graph into which this layer is being cloned.

Implements Layer.

Definition at line 47 of file QuantizedLstmLayer.cpp.

48{
49 auto layer = CloneBase<QuantizedLstmLayer>(graph, GetName());
50
51 layer->m_QuantizedLstmParameters.m_InputToInputWeights = m_QuantizedLstmParameters.m_InputToInputWeights ?
52 m_QuantizedLstmParameters.m_InputToInputWeights : nullptr;
53 layer->m_QuantizedLstmParameters.m_InputToForgetWeights = m_QuantizedLstmParameters.m_InputToForgetWeights ?
54 m_QuantizedLstmParameters.m_InputToForgetWeights : nullptr;
55 layer->m_QuantizedLstmParameters.m_InputToCellWeights = m_QuantizedLstmParameters.m_InputToCellWeights ?
56 m_QuantizedLstmParameters.m_InputToCellWeights : nullptr;
57 layer->m_QuantizedLstmParameters.m_InputToOutputWeights = m_QuantizedLstmParameters.m_InputToOutputWeights ?
58 m_QuantizedLstmParameters.m_InputToOutputWeights : nullptr;
59
60 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights = m_QuantizedLstmParameters.m_RecurrentToInputWeights ?
61 m_QuantizedLstmParameters.m_RecurrentToInputWeights : nullptr;
62 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights = m_QuantizedLstmParameters.m_RecurrentToForgetWeights
63 ? m_QuantizedLstmParameters.m_RecurrentToForgetWeights : nullptr;
64 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights = m_QuantizedLstmParameters.m_RecurrentToCellWeights ?
65 m_QuantizedLstmParameters.m_RecurrentToCellWeights : nullptr;
66 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights = m_QuantizedLstmParameters.m_RecurrentToOutputWeights
67 ? m_QuantizedLstmParameters.m_RecurrentToOutputWeights : nullptr;
68
69 layer->m_QuantizedLstmParameters.m_InputGateBias = m_QuantizedLstmParameters.m_InputGateBias ?
70 m_QuantizedLstmParameters.m_InputGateBias : nullptr;
71 layer->m_QuantizedLstmParameters.m_ForgetGateBias = m_QuantizedLstmParameters.m_ForgetGateBias ?
72 m_QuantizedLstmParameters.m_ForgetGateBias : nullptr;
73 layer->m_QuantizedLstmParameters.m_CellBias = m_QuantizedLstmParameters.m_CellBias ?
74 m_QuantizedLstmParameters.m_CellBias : nullptr;
75 layer->m_QuantizedLstmParameters.m_OutputGateBias = m_QuantizedLstmParameters.m_OutputGateBias ?
76 m_QuantizedLstmParameters.m_OutputGateBias : nullptr;
77
78 return std::move(layer);
79}

References Layer::CloneBase(), Layer::GetName(), Layer::Graph, m_QuantizedLstmParameters, and QuantizedLstmLayer().

◆ CreateWorkload()

std::unique_ptr< IWorkload > CreateWorkload ( const IWorkloadFactory & factory) const
overridevirtual

Makes a workload for the QuantizedLstm type.

Parameters
[in]graphThe graph where this layer can be found.
[in]factoryThe workload factory which will create the workload.
Returns
A pointer to the created workload, or nullptr if not created.

Implements Layer.

Definition at line 22 of file QuantizedLstmLayer.cpp.

23{
24 QuantizedLstmQueueDescriptor descriptor;
25
26 // QuantizedLstmLayer parameters - there are no optional params
27 descriptor.m_InputToInputWeights = m_QuantizedLstmParameters.m_InputToInputWeights.get();
28 descriptor.m_InputToForgetWeights = m_QuantizedLstmParameters.m_InputToForgetWeights.get();
29 descriptor.m_InputToCellWeights = m_QuantizedLstmParameters.m_InputToCellWeights.get();
30 descriptor.m_InputToOutputWeights = m_QuantizedLstmParameters.m_InputToOutputWeights.get();
31
32 descriptor.m_RecurrentToInputWeights = m_QuantizedLstmParameters.m_RecurrentToInputWeights.get();
33 descriptor.m_RecurrentToForgetWeights = m_QuantizedLstmParameters.m_RecurrentToForgetWeights.get();
34 descriptor.m_RecurrentToCellWeights = m_QuantizedLstmParameters.m_RecurrentToCellWeights.get();
35 descriptor.m_RecurrentToOutputWeights = m_QuantizedLstmParameters.m_RecurrentToOutputWeights.get();
36
37 descriptor.m_InputGateBias = m_QuantizedLstmParameters.m_InputGateBias.get();
38 descriptor.m_ForgetGateBias = m_QuantizedLstmParameters.m_ForgetGateBias.get();
39 descriptor.m_CellBias = m_QuantizedLstmParameters.m_CellBias.get();
40 descriptor.m_OutputGateBias = m_QuantizedLstmParameters.m_OutputGateBias.get();
41
42 SetAdditionalInfo(descriptor);
43
44 return factory.CreateWorkload(LayerType::QuantizedLstm, descriptor, PrepInfoAndDesc(descriptor));
45}

References IWorkloadFactory::CreateWorkload(), QuantizedLstmQueueDescriptor::m_CellBias, QuantizedLstmQueueDescriptor::m_ForgetGateBias, QuantizedLstmQueueDescriptor::m_InputGateBias, QuantizedLstmQueueDescriptor::m_InputToCellWeights, QuantizedLstmQueueDescriptor::m_InputToForgetWeights, QuantizedLstmQueueDescriptor::m_InputToInputWeights, QuantizedLstmQueueDescriptor::m_InputToOutputWeights, QuantizedLstmQueueDescriptor::m_OutputGateBias, m_QuantizedLstmParameters, QuantizedLstmQueueDescriptor::m_RecurrentToCellWeights, QuantizedLstmQueueDescriptor::m_RecurrentToForgetWeights, QuantizedLstmQueueDescriptor::m_RecurrentToInputWeights, QuantizedLstmQueueDescriptor::m_RecurrentToOutputWeights, Layer::PrepInfoAndDesc(), armnn::QuantizedLstm, and Layer::SetAdditionalInfo().

◆ ExecuteStrategy()

void ExecuteStrategy ( IStrategy & strategy) const
overridevirtual

Apply a visitor to this layer.

Reimplemented from Layer.

Definition at line 239 of file QuantizedLstmLayer.cpp.

240{
241 std::vector<ConstTensor> constTensors;
242
243 ManagedConstTensorHandle managedInputToInputWeights(m_QuantizedLstmParameters.m_InputToInputWeights);
244 ManagedConstTensorHandle managedInputToForgetWeights(m_QuantizedLstmParameters.m_InputToForgetWeights);
245 ManagedConstTensorHandle managedInputToCellWeights(m_QuantizedLstmParameters.m_InputToCellWeights);
246 ManagedConstTensorHandle managedInputToOutputWeights(m_QuantizedLstmParameters.m_InputToOutputWeights);
247
248 ManagedConstTensorHandle managedRecurrentToInputWeights(m_QuantizedLstmParameters.m_RecurrentToInputWeights);
249 ManagedConstTensorHandle managedRecurrentToForgetWeights(m_QuantizedLstmParameters.m_RecurrentToForgetWeights);
250 ManagedConstTensorHandle managedRecurrentToCellWeights(m_QuantizedLstmParameters.m_RecurrentToCellWeights);
251 ManagedConstTensorHandle managedRecurrentToOutputWeights(m_QuantizedLstmParameters.m_RecurrentToOutputWeights);
252
253 ManagedConstTensorHandle managedInputGateBias(m_QuantizedLstmParameters.m_InputGateBias);
254 ManagedConstTensorHandle managedForgetGateBias(m_QuantizedLstmParameters.m_ForgetGateBias);
255 ManagedConstTensorHandle managedCellBias(m_QuantizedLstmParameters.m_CellBias);
256 ManagedConstTensorHandle managedOutputGateBias(m_QuantizedLstmParameters.m_OutputGateBias);
257
258 // InputToX weight tensors
259 if (m_QuantizedLstmParameters.m_InputToInputWeights != nullptr)
260 {
261 constTensors.emplace_back(ConstTensor(managedInputToInputWeights.GetTensorInfo(),
262 managedInputToInputWeights.Map()));
263 }
264
265 if (m_QuantizedLstmParameters.m_InputToForgetWeights != nullptr)
266 {
267 constTensors.emplace_back(ConstTensor(managedInputToForgetWeights.GetTensorInfo(),
268 managedInputToForgetWeights.Map()));
269 }
270
271 if (m_QuantizedLstmParameters.m_InputToCellWeights != nullptr)
272 {
273 constTensors.emplace_back(ConstTensor(managedInputToCellWeights.GetTensorInfo(),
274 managedInputToCellWeights.Map()));
275 }
276
277 if (m_QuantizedLstmParameters.m_InputToOutputWeights != nullptr)
278 {
279 constTensors.emplace_back(ConstTensor(managedInputToOutputWeights.GetTensorInfo(),
280 managedInputToOutputWeights.Map()));
281 }
282
283 // RecurrentToX weight tensors
284 if (m_QuantizedLstmParameters.m_RecurrentToInputWeights != nullptr)
285 {
286 constTensors.emplace_back(ConstTensor(
287 managedRecurrentToInputWeights.GetTensorInfo(),
288 managedRecurrentToInputWeights.Map()));
289 }
290
291 if (m_QuantizedLstmParameters.m_RecurrentToForgetWeights != nullptr)
292 {
293 constTensors.emplace_back(ConstTensor(
294 managedRecurrentToForgetWeights.GetTensorInfo(),
295 managedRecurrentToForgetWeights.Map()));
296 }
297
298 if (m_QuantizedLstmParameters.m_RecurrentToCellWeights != nullptr)
299 {
300 constTensors.emplace_back(ConstTensor(
301 managedRecurrentToCellWeights.GetTensorInfo(),
302 managedRecurrentToCellWeights.Map()));
303 }
304
305 if (m_QuantizedLstmParameters.m_RecurrentToOutputWeights != nullptr)
306 {
307 constTensors.emplace_back(ConstTensor(
308 managedRecurrentToOutputWeights.GetTensorInfo(),
309 managedRecurrentToOutputWeights.Map()));
310 }
311
312 // Bias tensors
313 if (m_QuantizedLstmParameters.m_InputGateBias != nullptr)
314 {
315 constTensors.emplace_back(ConstTensor(managedInputGateBias.GetTensorInfo(),
316 managedInputGateBias.Map()));
317 }
318
319 if (m_QuantizedLstmParameters.m_ForgetGateBias != nullptr)
320 {
321 constTensors.emplace_back(ConstTensor(managedForgetGateBias.GetTensorInfo(),
322 managedForgetGateBias.Map()));
323 }
324
325 if (m_QuantizedLstmParameters.m_CellBias != nullptr)
326 {
327 constTensors.emplace_back(ConstTensor(managedCellBias.GetTensorInfo(),
328 managedCellBias.Map()));
329 }
330
331 if (m_QuantizedLstmParameters.m_OutputGateBias != nullptr)
332 {
333 constTensors.emplace_back(ConstTensor(managedOutputGateBias.GetTensorInfo(),
334 managedOutputGateBias.Map()));
335 }
336
337
338 strategy.ExecuteStrategy(this, BaseDescriptor(), constTensors, GetName());
339}

References IStrategy::ExecuteStrategy(), Layer::GetName(), ManagedConstTensorHandle::GetTensorInfo(), m_QuantizedLstmParameters, and ManagedConstTensorHandle::Map().

◆ GetConstantTensorsByRef()

Layer::ImmutableConstantTensors GetConstantTensorsByRef ( ) const
overrideprotectedvirtual

Retrieve the handles to the constant values stored by the layer.

Returns
A vector of the constant tensors stored by this layer.

Reimplemented from Layer.

Definition at line 217 of file QuantizedLstmLayer.cpp.

218{
219 // For API stability DO NOT ALTER order and add new members to the end of vector
220 return
221 {
222 m_QuantizedLstmParameters.m_InputToInputWeights,
223 m_QuantizedLstmParameters.m_InputToForgetWeights,
224 m_QuantizedLstmParameters.m_InputToCellWeights,
225 m_QuantizedLstmParameters.m_InputToOutputWeights,
226
227 m_QuantizedLstmParameters.m_RecurrentToInputWeights,
228 m_QuantizedLstmParameters.m_RecurrentToForgetWeights,
229 m_QuantizedLstmParameters.m_RecurrentToCellWeights,
230 m_QuantizedLstmParameters.m_RecurrentToOutputWeights,
231
232 m_QuantizedLstmParameters.m_InputGateBias,
233 m_QuantizedLstmParameters.m_ForgetGateBias,
234 m_QuantizedLstmParameters.m_CellBias,
235 m_QuantizedLstmParameters.m_OutputGateBias
236 };
237}

References m_QuantizedLstmParameters.

◆ InferOutputShapes()

std::vector< TensorShape > InferOutputShapes ( const std::vector< TensorShape > & inputShapes) const
overridevirtual

By default returns inputShapes if the number of inputs are equal to number of outputs, otherwise infers the output shapes from given input shapes and layer properties.

Parameters
[in]inputShapesThe input shapes layer has.
Returns
A vector to the inferred output shape.

Reimplemented from Layer.

Definition at line 81 of file QuantizedLstmLayer.cpp.

82{
83 if (inputShapes.size() != 3)
84 {
85 throw armnn::Exception("inputShapes' size is \"" + std::to_string(inputShapes.size()) +
86 "\" - should be \"3\".");
87 }
88
89 // Get input values for validation
90 unsigned int numBatches = inputShapes[0][0];
91 unsigned int outputSize = inputShapes[1][1];
92
93 std::vector<TensorShape> outShapes;
94 outShapes.push_back(TensorShape({numBatches, outputSize})); // cellStateOut
95 outShapes.push_back(TensorShape({numBatches, outputSize})); // output
96
97 return outShapes;
98}

Referenced by ValidateTensorShapesFromInputs().

◆ ValidateTensorShapesFromInputs()

void ValidateTensorShapesFromInputs ( )
overridevirtual

Check if the input tensor shape(s) will lead to a valid configuration of QuantizedLstmLayer.

Parameters
[in]shapeInferenceMethodIndicates if output shape shall be overwritten or just validated.

Implements Layer.

Definition at line 100 of file QuantizedLstmLayer.cpp.

101{
102 VerifyLayerConnections(3, CHECK_LOCATION());
103
104 const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape();
105
106 VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod);
107
108 auto inferredShapes = InferOutputShapes(
109 {
110 GetInputSlot(0).GetTensorInfo().GetShape(), // input
111 GetInputSlot(1).GetTensorInfo().GetShape(), // previousCellStateIn
112 GetInputSlot(2).GetTensorInfo().GetShape() // previousOutputIn
113 });
114
115 if (inferredShapes.size() != 2)
116 {
117 throw armnn::LayerValidationException("inferredShapes has "
118 + std::to_string(inferredShapes.size()) +
119 " element(s) - should only have 2.");
120 }
121
122 // Check weights and bias for nullptr
123 if (!m_QuantizedLstmParameters.m_InputToInputWeights)
124 {
125 throw armnn::LayerValidationException("QuantizedLstmLayer: "
126 "m_QuantizedLstmParameters.m_InputToInputWeights "
127 "should not be null.");
128 }
129
130 if (!m_QuantizedLstmParameters.m_InputToForgetWeights)
131 {
132 throw armnn::LayerValidationException("QuantizedLstmLayer: "
133 "m_QuantizedLstmParameters.m_InputToForgetWeights "
134 "should not be null.");
135 }
136
137 if (!m_QuantizedLstmParameters.m_InputToCellWeights)
138 {
139 throw armnn::LayerValidationException("QuantizedLstmLayer: "
140 "m_QuantizedLstmParameters.m_InputToCellWeights "
141 "should not be null.");
142 }
143
144 if (!m_QuantizedLstmParameters.m_InputToOutputWeights)
145 {
146 throw armnn::LayerValidationException("QuantizedLstmLayer: "
147 "m_QuantizedLstmParameters.m_InputToOutputWeights "
148 "should not be null.");
149 }
150
151 if (!m_QuantizedLstmParameters.m_RecurrentToInputWeights)
152 {
153 throw armnn::LayerValidationException("QuantizedLstmLayer: "
154 "m_QuantizedLstmParameters.m_RecurrentToInputWeights "
155 "should not be null.");
156 }
157
158 if (!m_QuantizedLstmParameters.m_RecurrentToForgetWeights)
159 {
160 throw armnn::LayerValidationException("QuantizedLstmLayer: "
161 "m_QuantizedLstmParameters.m_RecurrentToForgetWeights "
162 "should not be null.");
163 }
164
165 if (!m_QuantizedLstmParameters.m_RecurrentToCellWeights)
166 {
167 throw armnn::LayerValidationException("QuantizedLstmLayer: "
168 "m_QuantizedLstmParameters.m_RecurrentToCellWeights "
169 "should not be null.");
170 }
171
172 if (!m_QuantizedLstmParameters.m_RecurrentToOutputWeights)
173 {
174 throw armnn::LayerValidationException("QuantizedLstmLayer: "
175 "m_QuantizedLstmParameters.m_RecurrentToOutputWeights "
176 "should not be null.");
177 }
178
179 if (!m_QuantizedLstmParameters.m_InputGateBias)
180 {
181 throw armnn::LayerValidationException("QuantizedLstmLayer: "
182 "m_QuantizedLstmParameters.m_InputGateBias "
183 "should not be null.");
184 }
185
186 if (!m_QuantizedLstmParameters.m_ForgetGateBias)
187 {
188 throw armnn::LayerValidationException("QuantizedLstmLayer: "
189 "m_QuantizedLstmParameters.m_ForgetGateBias "
190 "should not be null.");
191 }
192
193 if (!m_QuantizedLstmParameters.m_CellBias)
194 {
195 throw armnn::LayerValidationException("QuantizedLstmLayer: "
196 "m_QuantizedLstmParameters.m_CellBias "
197 "should not be null.");
198 }
199
200 if (!m_QuantizedLstmParameters.m_OutputGateBias)
201 {
202 throw armnn::LayerValidationException("QuantizedLstmLayer: "
203 "m_QuantizedLstmParameters.m_OutputGateBias "
204 "should not be null.");
205 }
206
207 // Check output TensorShape(s) match inferred shape
208 ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "QuantizedLstmLayer");
209
210 ValidateAndCopyShape(GetOutputSlot(1).GetTensorInfo().GetShape(),
211 inferredShapes[1],
212 m_ShapeInferenceMethod,
213 "QuantizedLstmLayer",
214 1);
215}
#define CHECK_LOCATION()
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)

References CHECK_LOCATION, Layer::GetInputSlot(), Layer::GetOutputSlot(), TensorInfo::GetShape(), InputSlot::GetTensorInfo(), OutputSlot::GetTensorInfo(), armnnUtils::GetTensorInfo(), InferOutputShapes(), m_QuantizedLstmParameters, Layer::m_ShapeInferenceMethod, Layer::ValidateAndCopyShape(), Layer::VerifyLayerConnections(), and Layer::VerifyShapeInferenceType().

Member Data Documentation

◆ m_QuantizedLstmParameters


The documentation for this class was generated from the following files: