ArmNN
 22.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
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 654 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 656 of file WorkloadData.hpp.

657  : m_InputToInputWeights(nullptr)
658  , m_InputToForgetWeights(nullptr)
659  , m_InputToCellWeights(nullptr)
660  , m_InputToOutputWeights(nullptr)
661 
662  , m_RecurrentToInputWeights(nullptr)
663  , m_RecurrentToForgetWeights(nullptr)
664  , m_RecurrentToCellWeights(nullptr)
665  , m_RecurrentToOutputWeights(nullptr)
666 
667  , m_InputGateBias(nullptr)
668  , m_ForgetGateBias(nullptr)
669  , m_CellBias(nullptr)
670  , m_OutputGateBias(nullptr)
671  {}
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 3434 of file WorkloadData.cpp.

References WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, armnn::QAsymmU8, armnn::QSymmS16, armnn::Signed32, and QueueDescriptor::ValidateTensorNumDimNumElem().

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

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

Definition at line 684 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

Definition at line 683 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

Definition at line 675 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

Definition at line 674 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

Definition at line 673 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

Definition at line 676 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

Definition at line 686 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

Definition at line 680 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

Definition at line 679 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

Definition at line 678 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

Definition at line 681 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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