ArmNN
 24.02
QuantizedLstmQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

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

Public Member Functions

 QuantizedLstmQueueDescriptor ()
 
void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptor
virtual ~QueueDescriptor ()=default
 
void ValidateTensorNumDimensions (const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
 
void ValidateTensorNumDimNumElem (const TensorInfo &tensorInfo, unsigned int numDimension, unsigned int numElements, std::string const &tensorName) const
 
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
 
bool m_AllowExpandedDims = false
 

Additional Inherited Members

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

Detailed Description

Definition at line 614 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 616 of file WorkloadData.hpp.

617  : m_InputToInputWeights(nullptr)
618  , m_InputToForgetWeights(nullptr)
619  , m_InputToCellWeights(nullptr)
620  , m_InputToOutputWeights(nullptr)
621 
622  , m_RecurrentToInputWeights(nullptr)
623  , m_RecurrentToForgetWeights(nullptr)
624  , m_RecurrentToCellWeights(nullptr)
625  , m_RecurrentToOutputWeights(nullptr)
626 
627  , m_InputGateBias(nullptr)
628  , m_ForgetGateBias(nullptr)
629  , m_CellBias(nullptr)
630  , m_OutputGateBias(nullptr)
631  {}

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3432 of file WorkloadData.cpp.

3433 {
3434  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
3435 
3436  // Validate number of inputs/outputs
3437  ValidateNumInputs(workloadInfo, descriptorName, 3);
3438  ValidateNumOutputs(workloadInfo, descriptorName, 2);
3439 
3440  // Input/output tensor infos
3441  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
3442  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
3443  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
3444 
3445  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
3446  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
3447 
3448  std::vector<DataType> inputOutputSupportedTypes =
3449  {
3451  };
3452 
3453  std::vector<DataType> cellStateSupportedTypes =
3454  {
3456  };
3457 
3458  std::vector<DataType> weightsSupportedTypes =
3459  {
3461  };
3462 
3463  std::vector<DataType> biasSupportedTypes =
3464  {
3466  };
3467 
3468  // Validate types of input/output tensors
3469  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3470  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3471  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3472 
3473  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3474  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3475 
3476  // Validate matching types of input/output tensors
3477  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3478  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3479  "outputStateIn", "outputStateOut");
3480  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3481 
3482  // Validate matching quantization info for input/output tensors
3483  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3484  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
3485  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3486 
3487  // Infer number of batches, input size and output size from tensor dimensions
3488  const uint32_t numBatches = inputInfo.GetShape()[0];
3489  const uint32_t inputSize = inputInfo.GetShape()[1];
3490  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3491 
3492  // Validate number of dimensions and number of elements for input/output tensors
3493  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
3494  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
3495  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
3496  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
3497  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
3498 
3499  // Validate number of dimensions and number of elements for weights tensors
3500  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
3501  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
3502  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
3503 
3504  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
3505  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
3506  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
3507 
3508  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
3509  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
3510  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
3511 
3512  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
3513  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
3514  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
3515 
3516  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
3517  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
3518  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
3519 
3520  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
3521  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
3522  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
3523  " RecurrentToForgetWeights");
3524 
3525  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
3526  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
3527  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3528 
3529  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
3530  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
3531  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3532 
3533  // Validate data types for weights tensors (all should match each other)
3534  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3535 
3536  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3537  "inputToInputWeights", "inputToForgetWeights");
3538  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3539  "inputToInputWeights", "inputToCellWeights");
3540  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3541  "inputToInputWeights", "inputToOutputWeights");
3542 
3543  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3544  "inputToInputWeights", "recurrentToInputWeights");
3545  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3546  "inputToInputWeights", "recurrentToForgeteights");
3547  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3548  "inputToInputWeights", "recurrentToCellWeights");
3549  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3550  "inputToInputWeights", "recurrentToOutputWeights");
3551 
3552  // Validate matching quantization info for weight tensors (all should match each other)
3553  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3554  descriptorName, "inputToInputWeights", "inputToForgetWeights");
3555  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3556  descriptorName, "inputToInputWeights", "inputToCellWeights");
3557  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3558  descriptorName, "inputToInputWeights", "inputToOutputWeights");
3559 
3560  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3561  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
3562  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3563  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
3564  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3565  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
3566  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3567  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
3568 
3569  // Validate number of dimensions and number of elements in bias tensors
3570  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
3571  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
3572  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
3573 
3574  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
3575  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
3576  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
3577 
3578  ValidatePointer(m_CellBias, descriptorName, "CellBias");
3579  auto cellBiasInfo = m_CellBias->GetTensorInfo();
3580  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
3581 
3582  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
3583  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
3584  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
3585 
3586  // Validate data types for bias tensors (all should match each other)
3587  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3588 
3589  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3590  "inputGateBias", "forgetGateBias");
3591  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3592  "inputGateBias", "cellBias");
3593  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3594  "inputGateBias", "outputGateBias");
3595 
3596  // Validate bias tensor quantization info
3597  ValidateBiasTensorQuantization(inputGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3598  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3599  ValidateBiasTensorQuantization(cellBiasInfo, inputToInputWeightsInfo, descriptorName);
3600  ValidateBiasTensorQuantization(outputGateBiasInfo, inputToInputWeightsInfo, descriptorName);
3601 }

References TensorInfo::GetShape(), ConstTensorHandle::GetTensorInfo(), QuantizedLstmQueueDescriptor::m_CellBias, QuantizedLstmQueueDescriptor::m_ForgetGateBias, QuantizedLstmQueueDescriptor::m_InputGateBias, WorkloadInfo::m_InputTensorInfos, QuantizedLstmQueueDescriptor::m_InputToCellWeights, QuantizedLstmQueueDescriptor::m_InputToForgetWeights, QuantizedLstmQueueDescriptor::m_InputToInputWeights, QuantizedLstmQueueDescriptor::m_InputToOutputWeights, QuantizedLstmQueueDescriptor::m_OutputGateBias, WorkloadInfo::m_OutputTensorInfos, QuantizedLstmQueueDescriptor::m_RecurrentToCellWeights, QuantizedLstmQueueDescriptor::m_RecurrentToForgetWeights, QuantizedLstmQueueDescriptor::m_RecurrentToInputWeights, QuantizedLstmQueueDescriptor::m_RecurrentToOutputWeights, armnn::QAsymmU8, armnn::QSymmS16, armnn::Signed32, and QueueDescriptor::ValidateTensorNumDimNumElem().

Member Data Documentation

◆ m_CellBias

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

The documentation for this struct was generated from the following files:
armnn::QuantizedLstmQueueDescriptor::m_CellBias
const ConstTensorHandle * m_CellBias
Definition: WorkloadData.hpp:645
armnn::QuantizedLstmQueueDescriptor::m_RecurrentToInputWeights
const ConstTensorHandle * m_RecurrentToInputWeights
Definition: WorkloadData.hpp:638
armnn::QuantizedLstmQueueDescriptor::m_InputToForgetWeights
const ConstTensorHandle * m_InputToForgetWeights
Definition: WorkloadData.hpp:634
armnn::QuantizedLstmQueueDescriptor::m_RecurrentToOutputWeights
const ConstTensorHandle * m_RecurrentToOutputWeights
Definition: WorkloadData.hpp:641
armnn::QuantizedLstmQueueDescriptor::m_InputGateBias
const ConstTensorHandle * m_InputGateBias
Definition: WorkloadData.hpp:643
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::ConstTensorHandle::GetTensorInfo
const TensorInfo & GetTensorInfo() const
Definition: TensorHandle.hpp:40
armnn::DataType::QSymmS16
@ QSymmS16
armnn::QuantizedLstmQueueDescriptor::m_RecurrentToCellWeights
const ConstTensorHandle * m_RecurrentToCellWeights
Definition: WorkloadData.hpp:640
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QuantizedLstmQueueDescriptor::m_InputToInputWeights
const ConstTensorHandle * m_InputToInputWeights
Definition: WorkloadData.hpp:633
armnn::QuantizedLstmQueueDescriptor::m_RecurrentToForgetWeights
const ConstTensorHandle * m_RecurrentToForgetWeights
Definition: WorkloadData.hpp:639
armnn::QuantizedLstmQueueDescriptor::m_InputToCellWeights
const ConstTensorHandle * m_InputToCellWeights
Definition: WorkloadData.hpp:635
armnn::QuantizedLstmQueueDescriptor::m_InputToOutputWeights
const ConstTensorHandle * m_InputToOutputWeights
Definition: WorkloadData.hpp:636
armnn::DataType::Signed32
@ Signed32
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
armnn::QueueDescriptor::ValidateTensorNumDimNumElem
void ValidateTensorNumDimNumElem(const TensorInfo &tensorInfo, unsigned int numDimension, unsigned int numElements, std::string const &tensorName) const
Definition: WorkloadData.cpp:435
armnn::QuantizedLstmQueueDescriptor::m_OutputGateBias
const ConstTensorHandle * m_OutputGateBias
Definition: WorkloadData.hpp:646
armnn::QuantizedLstmQueueDescriptor::m_ForgetGateBias
const ConstTensorHandle * m_ForgetGateBias
Definition: WorkloadData.hpp:644