ArmNN
 21.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
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
 
template<typename T >
const T * GetAdditionalInformation () const
 

Public Attributes

const ConstCpuTensorHandlem_InputToInputWeights
 
const ConstCpuTensorHandlem_InputToForgetWeights
 
const ConstCpuTensorHandlem_InputToCellWeights
 
const ConstCpuTensorHandlem_InputToOutputWeights
 
const ConstCpuTensorHandlem_RecurrentToInputWeights
 
const ConstCpuTensorHandlem_RecurrentToForgetWeights
 
const ConstCpuTensorHandlem_RecurrentToCellWeights
 
const ConstCpuTensorHandlem_RecurrentToOutputWeights
 
const ConstCpuTensorHandlem_InputGateBias
 
const ConstCpuTensorHandlem_ForgetGateBias
 
const ConstCpuTensorHandlem_CellBias
 
const ConstCpuTensorHandlem_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 604 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 606 of file WorkloadData.hpp.

607  : m_InputToInputWeights(nullptr)
608  , m_InputToForgetWeights(nullptr)
609  , m_InputToCellWeights(nullptr)
610  , m_InputToOutputWeights(nullptr)
611 
612  , m_RecurrentToInputWeights(nullptr)
613  , m_RecurrentToForgetWeights(nullptr)
614  , m_RecurrentToCellWeights(nullptr)
615  , m_RecurrentToOutputWeights(nullptr)
616 
617  , m_InputGateBias(nullptr)
618  , m_ForgetGateBias(nullptr)
619  , m_CellBias(nullptr)
620  , m_OutputGateBias(nullptr)
621  {}
const ConstCpuTensorHandle * m_RecurrentToForgetWeights
const ConstCpuTensorHandle * m_InputGateBias
const ConstCpuTensorHandle * m_InputToCellWeights
const ConstCpuTensorHandle * m_ForgetGateBias
const ConstCpuTensorHandle * m_RecurrentToInputWeights
const ConstCpuTensorHandle * m_RecurrentToCellWeights
const ConstCpuTensorHandle * m_RecurrentToOutputWeights
const ConstCpuTensorHandle * m_CellBias
const ConstCpuTensorHandle * m_OutputGateBias
const ConstCpuTensorHandle * m_InputToForgetWeights
const ConstCpuTensorHandle * m_InputToOutputWeights
const ConstCpuTensorHandle * m_InputToInputWeights

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3202 of file WorkloadData.cpp.

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

3203 {
3204  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
3205 
3206  // Validate number of inputs/outputs
3207  ValidateNumInputs(workloadInfo, descriptorName, 3);
3208  ValidateNumOutputs(workloadInfo, descriptorName, 2);
3209 
3210  // Input/output tensor infos
3211  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
3212  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
3213  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
3214 
3215  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
3216  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
3217 
3218  std::vector<DataType> inputOutputSupportedTypes =
3219  {
3221  };
3222 
3223  std::vector<DataType> cellStateSupportedTypes =
3224  {
3226  };
3227 
3228  std::vector<DataType> weightsSupportedTypes =
3229  {
3231  };
3232 
3233  std::vector<DataType> biasSupportedTypes =
3234  {
3236  };
3237 
3238  // Validate types of input/output tensors
3239  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3240  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3241  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3242 
3243  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3244  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3245 
3246  // Validate matching types of input/output tensors
3247  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3248  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3249  "outputStateIn", "outputStateOut");
3250  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3251 
3252  // Validate matching quantization info for input/output tensors
3253  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3254  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
3255  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3256 
3257  // Infer number of batches, input size and output size from tensor dimensions
3258  const uint32_t numBatches = inputInfo.GetShape()[0];
3259  const uint32_t inputSize = inputInfo.GetShape()[1];
3260  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3261 
3262  // Validate number of dimensions and number of elements for input/output tensors
3263  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
3264  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
3265  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
3266  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
3267  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
3268 
3269  // Validate number of dimensions and number of elements for weights tensors
3270  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
3271  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
3272  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
3273 
3274  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
3275  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
3276  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
3277 
3278  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
3279  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
3280  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
3281 
3282  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
3283  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
3284  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
3285 
3286  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
3287  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
3288  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
3289 
3290  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
3291  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
3292  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
3293  " RecurrentToForgetWeights");
3294 
3295  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
3296  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
3297  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3298 
3299  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
3300  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
3301  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3302 
3303  // Validate data types for weights tensors (all should match each other)
3304  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3305 
3306  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3307  "inputToInputWeights", "inputToForgetWeights");
3308  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3309  "inputToInputWeights", "inputToCellWeights");
3310  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3311  "inputToInputWeights", "inputToOutputWeights");
3312 
3313  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3314  "inputToInputWeights", "recurrentToInputWeights");
3315  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3316  "inputToInputWeights", "recurrentToForgeteights");
3317  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3318  "inputToInputWeights", "recurrentToCellWeights");
3319  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3320  "inputToInputWeights", "recurrentToOutputWeights");
3321 
3322  // Validate matching quantization info for weight tensors (all should match each other)
3323  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3324  descriptorName, "inputToInputWeights", "inputToForgetWeights");
3325  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3326  descriptorName, "inputToInputWeights", "inputToCellWeights");
3327  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3328  descriptorName, "inputToInputWeights", "inputToOutputWeights");
3329 
3330  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3331  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
3332  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3333  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
3334  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3335  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
3336  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3337  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
3338 
3339  // Validate number of dimensions and number of elements in bias tensors
3340  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
3341  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
3342  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
3343 
3344  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
3345  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
3346  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
3347 
3348  ValidatePointer(m_CellBias, descriptorName, "CellBias");
3349  auto cellBiasInfo = m_CellBias->GetTensorInfo();
3350  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
3351 
3352  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
3353  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
3354  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
3355 
3356  // Validate data types for bias tensors (all should match each other)
3357  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3358 
3359  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3360  "inputGateBias", "forgetGateBias");
3361  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3362  "inputGateBias", "cellBias");
3363  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3364  "inputGateBias", "outputGateBias");
3365 
3366  // Validate bias tensor quantization info
3367  ValidateBiasTensorQuantization(inputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3368  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3369  ValidateBiasTensorQuantization(cellBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3370  ValidateBiasTensorQuantization(outputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3371 }
const ConstCpuTensorHandle * m_RecurrentToForgetWeights
const ConstCpuTensorHandle * m_InputGateBias
const ConstCpuTensorHandle * m_InputToCellWeights
std::vector< TensorInfo > m_InputTensorInfos
const ConstCpuTensorHandle * m_ForgetGateBias
const ConstCpuTensorHandle * m_RecurrentToInputWeights
std::vector< TensorInfo > m_OutputTensorInfos
const ConstCpuTensorHandle * m_RecurrentToCellWeights
const ConstCpuTensorHandle * m_RecurrentToOutputWeights
const ConstCpuTensorHandle * m_CellBias
const ConstCpuTensorHandle * m_OutputGateBias
const ConstCpuTensorHandle * m_InputToForgetWeights
const ConstCpuTensorHandle * m_InputToOutputWeights
const ConstCpuTensorHandle * m_InputToInputWeights
const TensorInfo & GetTensorInfo() const

Member Data Documentation

◆ m_CellBias

const ConstCpuTensorHandle* m_CellBias

Definition at line 635 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstCpuTensorHandle* m_ForgetGateBias

Definition at line 634 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstCpuTensorHandle* m_InputGateBias

Definition at line 633 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstCpuTensorHandle* m_InputToCellWeights

Definition at line 625 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstCpuTensorHandle* m_InputToForgetWeights

Definition at line 624 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstCpuTensorHandle* m_InputToInputWeights

Definition at line 623 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstCpuTensorHandle* m_InputToOutputWeights

Definition at line 626 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstCpuTensorHandle* m_OutputGateBias

Definition at line 636 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstCpuTensorHandle* m_RecurrentToCellWeights

Definition at line 630 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstCpuTensorHandle* m_RecurrentToForgetWeights

Definition at line 629 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstCpuTensorHandle* m_RecurrentToInputWeights

Definition at line 628 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstCpuTensorHandle* m_RecurrentToOutputWeights

Definition at line 631 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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