ArmNN
 24.08
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 3436 of file WorkloadData.cpp.

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

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:436
armnn::QuantizedLstmQueueDescriptor::m_OutputGateBias
const ConstTensorHandle * m_OutputGateBias
Definition: WorkloadData.hpp:646
armnn::QuantizedLstmQueueDescriptor::m_ForgetGateBias
const ConstTensorHandle * m_ForgetGateBias
Definition: WorkloadData.hpp:644