ArmNN
 22.02
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 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 ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 637 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 639 of file WorkloadData.hpp.

640  : m_InputToInputWeights(nullptr)
641  , m_InputToForgetWeights(nullptr)
642  , m_InputToCellWeights(nullptr)
643  , m_InputToOutputWeights(nullptr)
644 
645  , m_RecurrentToInputWeights(nullptr)
646  , m_RecurrentToForgetWeights(nullptr)
647  , m_RecurrentToCellWeights(nullptr)
648  , m_RecurrentToOutputWeights(nullptr)
649 
650  , m_InputGateBias(nullptr)
651  , m_ForgetGateBias(nullptr)
652  , m_CellBias(nullptr)
653  , m_OutputGateBias(nullptr)
654  {}
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 3357 of file WorkloadData.cpp.

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

3358 {
3359  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
3360 
3361  // Validate number of inputs/outputs
3362  ValidateNumInputs(workloadInfo, descriptorName, 3);
3363  ValidateNumOutputs(workloadInfo, descriptorName, 2);
3364 
3365  // Input/output tensor infos
3366  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
3367  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
3368  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
3369 
3370  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
3371  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
3372 
3373  std::vector<DataType> inputOutputSupportedTypes =
3374  {
3376  };
3377 
3378  std::vector<DataType> cellStateSupportedTypes =
3379  {
3381  };
3382 
3383  std::vector<DataType> weightsSupportedTypes =
3384  {
3386  };
3387 
3388  std::vector<DataType> biasSupportedTypes =
3389  {
3391  };
3392 
3393  // Validate types of input/output tensors
3394  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3395  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3396  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3397 
3398  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3399  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3400 
3401  // Validate matching types of input/output tensors
3402  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3403  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3404  "outputStateIn", "outputStateOut");
3405  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3406 
3407  // Validate matching quantization info for input/output tensors
3408  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3409  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
3410  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3411 
3412  // Infer number of batches, input size and output size from tensor dimensions
3413  const uint32_t numBatches = inputInfo.GetShape()[0];
3414  const uint32_t inputSize = inputInfo.GetShape()[1];
3415  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3416 
3417  // Validate number of dimensions and number of elements for input/output tensors
3418  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
3419  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
3420  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
3421  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
3422  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
3423 
3424  // Validate number of dimensions and number of elements for weights tensors
3425  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
3426  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
3427  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
3428 
3429  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
3430  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
3431  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
3432 
3433  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
3434  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
3435  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
3436 
3437  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
3438  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
3439  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
3440 
3441  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
3442  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
3443  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
3444 
3445  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
3446  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
3447  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
3448  " RecurrentToForgetWeights");
3449 
3450  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
3451  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
3452  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3453 
3454  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
3455  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
3456  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3457 
3458  // Validate data types for weights tensors (all should match each other)
3459  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3460 
3461  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3462  "inputToInputWeights", "inputToForgetWeights");
3463  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3464  "inputToInputWeights", "inputToCellWeights");
3465  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3466  "inputToInputWeights", "inputToOutputWeights");
3467 
3468  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3469  "inputToInputWeights", "recurrentToInputWeights");
3470  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3471  "inputToInputWeights", "recurrentToForgeteights");
3472  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3473  "inputToInputWeights", "recurrentToCellWeights");
3474  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3475  "inputToInputWeights", "recurrentToOutputWeights");
3476 
3477  // Validate matching quantization info for weight tensors (all should match each other)
3478  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3479  descriptorName, "inputToInputWeights", "inputToForgetWeights");
3480  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3481  descriptorName, "inputToInputWeights", "inputToCellWeights");
3482  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3483  descriptorName, "inputToInputWeights", "inputToOutputWeights");
3484 
3485  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3486  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
3487  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3488  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
3489  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3490  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
3491  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3492  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
3493 
3494  // Validate number of dimensions and number of elements in bias tensors
3495  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
3496  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
3497  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
3498 
3499  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
3500  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
3501  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
3502 
3503  ValidatePointer(m_CellBias, descriptorName, "CellBias");
3504  auto cellBiasInfo = m_CellBias->GetTensorInfo();
3505  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
3506 
3507  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
3508  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
3509  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
3510 
3511  // Validate data types for bias tensors (all should match each other)
3512  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3513 
3514  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3515  "inputGateBias", "forgetGateBias");
3516  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3517  "inputGateBias", "cellBias");
3518  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3519  "inputGateBias", "outputGateBias");
3520 
3521  // Validate bias tensor quantization info
3522  ValidateBiasTensorQuantization(inputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3523  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3524  ValidateBiasTensorQuantization(cellBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3525  ValidateBiasTensorQuantization(outputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3526 }
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 668 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

Definition at line 667 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

Definition at line 666 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

Definition at line 658 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

Definition at line 657 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

Definition at line 656 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

Definition at line 659 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

Definition at line 669 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

Definition at line 663 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

Definition at line 662 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

Definition at line 661 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

Definition at line 664 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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