ArmNN
 21.08
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 621 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 623 of file WorkloadData.hpp.

624  : m_InputToInputWeights(nullptr)
625  , m_InputToForgetWeights(nullptr)
626  , m_InputToCellWeights(nullptr)
627  , m_InputToOutputWeights(nullptr)
628 
629  , m_RecurrentToInputWeights(nullptr)
630  , m_RecurrentToForgetWeights(nullptr)
631  , m_RecurrentToCellWeights(nullptr)
632  , m_RecurrentToOutputWeights(nullptr)
633 
634  , m_InputGateBias(nullptr)
635  , m_ForgetGateBias(nullptr)
636  , m_CellBias(nullptr)
637  , m_OutputGateBias(nullptr)
638  {}
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 3260 of file WorkloadData.cpp.

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

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

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

Definition at line 651 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

Definition at line 650 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

Definition at line 642 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

Definition at line 641 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

Definition at line 640 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

Definition at line 643 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

Definition at line 653 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

Definition at line 647 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

Definition at line 646 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

Definition at line 645 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

Definition at line 648 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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