ArmNN
 21.05
QuantizedLstmQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for QuantizedLstmQueueDescriptor:
QueueDescriptor

Public Member Functions

 QuantizedLstmQueueDescriptor ()
 
void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptor
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
 
template<typename T >
const T * GetAdditionalInformation () const
 

Public Attributes

const ConstTensorHandlem_InputToInputWeights
 
const ConstTensorHandlem_InputToForgetWeights
 
const ConstTensorHandlem_InputToCellWeights
 
const ConstTensorHandlem_InputToOutputWeights
 
const ConstTensorHandlem_RecurrentToInputWeights
 
const ConstTensorHandlem_RecurrentToForgetWeights
 
const ConstTensorHandlem_RecurrentToCellWeights
 
const ConstTensorHandlem_RecurrentToOutputWeights
 
const ConstTensorHandlem_InputGateBias
 
const ConstTensorHandlem_ForgetGateBias
 
const ConstTensorHandlem_CellBias
 
const ConstTensorHandlem_OutputGateBias
 
- Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
 
std::vector< ITensorHandle * > m_Outputs
 
void * m_AdditionalInfoObject
 

Additional Inherited Members

- Protected Member Functions inherited from QueueDescriptor
 ~QueueDescriptor ()=default
 
 QueueDescriptor ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 609 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 611 of file WorkloadData.hpp.

612  : m_InputToInputWeights(nullptr)
613  , m_InputToForgetWeights(nullptr)
614  , m_InputToCellWeights(nullptr)
615  , m_InputToOutputWeights(nullptr)
616 
617  , m_RecurrentToInputWeights(nullptr)
618  , m_RecurrentToForgetWeights(nullptr)
619  , m_RecurrentToCellWeights(nullptr)
620  , m_RecurrentToOutputWeights(nullptr)
621 
622  , m_InputGateBias(nullptr)
623  , m_ForgetGateBias(nullptr)
624  , m_CellBias(nullptr)
625  , m_OutputGateBias(nullptr)
626  {}
const ConstTensorHandle * m_InputGateBias
const ConstTensorHandle * m_RecurrentToInputWeights
const ConstTensorHandle * m_InputToForgetWeights
const ConstTensorHandle * m_RecurrentToCellWeights
const ConstTensorHandle * m_ForgetGateBias
const ConstTensorHandle * m_RecurrentToOutputWeights
const ConstTensorHandle * m_OutputGateBias
const ConstTensorHandle * m_RecurrentToForgetWeights
const ConstTensorHandle * m_InputToOutputWeights
const ConstTensorHandle * m_InputToInputWeights
const ConstTensorHandle * m_CellBias
const ConstTensorHandle * m_InputToCellWeights

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3250 of file WorkloadData.cpp.

References WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, armnn::QAsymmU8, armnn::QSymmS16, and armnn::Signed32.

3251 {
3252  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
3253 
3254  // Validate number of inputs/outputs
3255  ValidateNumInputs(workloadInfo, descriptorName, 3);
3256  ValidateNumOutputs(workloadInfo, descriptorName, 2);
3257 
3258  // Input/output tensor infos
3259  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
3260  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
3261  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
3262 
3263  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
3264  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
3265 
3266  std::vector<DataType> inputOutputSupportedTypes =
3267  {
3269  };
3270 
3271  std::vector<DataType> cellStateSupportedTypes =
3272  {
3274  };
3275 
3276  std::vector<DataType> weightsSupportedTypes =
3277  {
3279  };
3280 
3281  std::vector<DataType> biasSupportedTypes =
3282  {
3284  };
3285 
3286  // Validate types of input/output tensors
3287  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3288  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3289  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3290 
3291  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3292  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3293 
3294  // Validate matching types of input/output tensors
3295  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3296  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3297  "outputStateIn", "outputStateOut");
3298  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3299 
3300  // Validate matching quantization info for input/output tensors
3301  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3302  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
3303  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3304 
3305  // Infer number of batches, input size and output size from tensor dimensions
3306  const uint32_t numBatches = inputInfo.GetShape()[0];
3307  const uint32_t inputSize = inputInfo.GetShape()[1];
3308  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3309 
3310  // Validate number of dimensions and number of elements for input/output tensors
3311  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
3312  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
3313  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
3314  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
3315  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
3316 
3317  // Validate number of dimensions and number of elements for weights tensors
3318  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
3319  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
3320  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
3321 
3322  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
3323  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
3324  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
3325 
3326  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
3327  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
3328  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
3329 
3330  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
3331  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
3332  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
3333 
3334  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
3335  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
3336  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
3337 
3338  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
3339  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
3340  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
3341  " RecurrentToForgetWeights");
3342 
3343  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
3344  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
3345  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3346 
3347  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
3348  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
3349  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3350 
3351  // Validate data types for weights tensors (all should match each other)
3352  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3353 
3354  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3355  "inputToInputWeights", "inputToForgetWeights");
3356  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3357  "inputToInputWeights", "inputToCellWeights");
3358  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3359  "inputToInputWeights", "inputToOutputWeights");
3360 
3361  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3362  "inputToInputWeights", "recurrentToInputWeights");
3363  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3364  "inputToInputWeights", "recurrentToForgeteights");
3365  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3366  "inputToInputWeights", "recurrentToCellWeights");
3367  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3368  "inputToInputWeights", "recurrentToOutputWeights");
3369 
3370  // Validate matching quantization info for weight tensors (all should match each other)
3371  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3372  descriptorName, "inputToInputWeights", "inputToForgetWeights");
3373  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3374  descriptorName, "inputToInputWeights", "inputToCellWeights");
3375  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3376  descriptorName, "inputToInputWeights", "inputToOutputWeights");
3377 
3378  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3379  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
3380  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3381  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
3382  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3383  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
3384  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3385  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
3386 
3387  // Validate number of dimensions and number of elements in bias tensors
3388  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
3389  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
3390  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
3391 
3392  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
3393  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
3394  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
3395 
3396  ValidatePointer(m_CellBias, descriptorName, "CellBias");
3397  auto cellBiasInfo = m_CellBias->GetTensorInfo();
3398  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
3399 
3400  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
3401  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
3402  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
3403 
3404  // Validate data types for bias tensors (all should match each other)
3405  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3406 
3407  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3408  "inputGateBias", "forgetGateBias");
3409  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3410  "inputGateBias", "cellBias");
3411  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3412  "inputGateBias", "outputGateBias");
3413 
3414  // Validate bias tensor quantization info
3415  ValidateBiasTensorQuantization(inputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3416  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3417  ValidateBiasTensorQuantization(cellBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3418  ValidateBiasTensorQuantization(outputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3419 }
const ConstTensorHandle * m_InputGateBias
const ConstTensorHandle * m_RecurrentToInputWeights
const TensorInfo & GetTensorInfo() const
std::vector< TensorInfo > m_InputTensorInfos
const ConstTensorHandle * m_InputToForgetWeights
const ConstTensorHandle * m_RecurrentToCellWeights
const ConstTensorHandle * m_ForgetGateBias
std::vector< TensorInfo > m_OutputTensorInfos
const ConstTensorHandle * m_RecurrentToOutputWeights
const ConstTensorHandle * m_OutputGateBias
const ConstTensorHandle * m_RecurrentToForgetWeights
const ConstTensorHandle * m_InputToOutputWeights
const ConstTensorHandle * m_InputToInputWeights
const ConstTensorHandle * m_CellBias
const ConstTensorHandle * m_InputToCellWeights

Member Data Documentation

◆ m_CellBias

const ConstTensorHandle* m_CellBias

Definition at line 640 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

Definition at line 639 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

Definition at line 638 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

Definition at line 630 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

Definition at line 629 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

Definition at line 628 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

Definition at line 631 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

Definition at line 641 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

Definition at line 635 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

Definition at line 634 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

Definition at line 633 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

Definition at line 636 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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