ArmNN
 20.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 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 3186 of file WorkloadData.cpp.

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

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