ArmNN
 21.11
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 632 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 634 of file WorkloadData.hpp.

635  : m_InputToInputWeights(nullptr)
636  , m_InputToForgetWeights(nullptr)
637  , m_InputToCellWeights(nullptr)
638  , m_InputToOutputWeights(nullptr)
639 
640  , m_RecurrentToInputWeights(nullptr)
641  , m_RecurrentToForgetWeights(nullptr)
642  , m_RecurrentToCellWeights(nullptr)
643  , m_RecurrentToOutputWeights(nullptr)
644 
645  , m_InputGateBias(nullptr)
646  , m_ForgetGateBias(nullptr)
647  , m_CellBias(nullptr)
648  , m_OutputGateBias(nullptr)
649  {}
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 3329 of file WorkloadData.cpp.

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

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

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstTensorHandle* m_ForgetGateBias

Definition at line 662 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstTensorHandle* m_InputGateBias

Definition at line 661 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstTensorHandle* m_InputToCellWeights

Definition at line 653 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstTensorHandle* m_InputToForgetWeights

Definition at line 652 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstTensorHandle* m_InputToInputWeights

Definition at line 651 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstTensorHandle* m_InputToOutputWeights

Definition at line 654 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstTensorHandle* m_OutputGateBias

Definition at line 664 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstTensorHandle* m_RecurrentToCellWeights

Definition at line 658 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstTensorHandle* m_RecurrentToForgetWeights

Definition at line 657 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstTensorHandle* m_RecurrentToInputWeights

Definition at line 656 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstTensorHandle* m_RecurrentToOutputWeights

Definition at line 659 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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