ArmNN
 20.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
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) 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
 

Additional Inherited Members

- Protected Member Functions inherited from QueueDescriptor
 ~QueueDescriptor ()=default
 
 QueueDescriptor ()=default
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 575 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 577 of file WorkloadData.hpp.

578  : m_InputToInputWeights(nullptr)
579  , m_InputToForgetWeights(nullptr)
580  , m_InputToCellWeights(nullptr)
581  , m_InputToOutputWeights(nullptr)
582 
583  , m_RecurrentToInputWeights(nullptr)
584  , m_RecurrentToForgetWeights(nullptr)
585  , m_RecurrentToCellWeights(nullptr)
586  , m_RecurrentToOutputWeights(nullptr)
587 
588  , m_InputGateBias(nullptr)
589  , m_ForgetGateBias(nullptr)
590  , m_CellBias(nullptr)
591  , m_OutputGateBias(nullptr)
592  {}
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 3133 of file WorkloadData.cpp.

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

3134 {
3135  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
3136 
3137  // Validate number of inputs/outputs
3138  ValidateNumInputs(workloadInfo, descriptorName, 3);
3139  ValidateNumOutputs(workloadInfo, descriptorName, 2);
3140 
3141  // Input/output tensor infos
3142  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
3143  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
3144  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
3145 
3146  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
3147  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
3148 
3149  std::vector<DataType> inputOutputSupportedTypes =
3150  {
3152  };
3153 
3154  std::vector<DataType> cellStateSupportedTypes =
3155  {
3157  };
3158 
3159  std::vector<DataType> weightsSupportedTypes =
3160  {
3162  };
3163 
3164  std::vector<DataType> biasSupportedTypes =
3165  {
3167  };
3168 
3169  // Validate types of input/output tensors
3170  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
3171  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
3172  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
3173 
3174  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
3175  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
3176 
3177  // Validate matching types of input/output tensors
3178  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3179  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
3180  "outputStateIn", "outputStateOut");
3181  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3182 
3183  // Validate matching quantization info for input/output tensors
3184  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
3185  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
3186  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
3187 
3188  // Infer number of batches, input size and output size from tensor dimensions
3189  const uint32_t numBatches = inputInfo.GetShape()[0];
3190  const uint32_t inputSize = inputInfo.GetShape()[1];
3191  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
3192 
3193  // Validate number of dimensions and number of elements for input/output tensors
3194  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
3195  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
3196  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
3197  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
3198  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
3199 
3200  // Validate number of dimensions and number of elements for weights tensors
3201  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
3202  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
3203  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
3204 
3205  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
3206  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
3207  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
3208 
3209  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
3210  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
3211  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
3212 
3213  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
3214  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
3215  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
3216 
3217  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
3218  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
3219  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
3220 
3221  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
3222  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
3223  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
3224  " RecurrentToForgetWeights");
3225 
3226  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
3227  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
3228  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3229 
3230  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
3231  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
3232  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
3233 
3234  // Validate data types for weights tensors (all should match each other)
3235  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
3236 
3237  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
3238  "inputToInputWeights", "inputToForgetWeights");
3239  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
3240  "inputToInputWeights", "inputToCellWeights");
3241  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
3242  "inputToInputWeights", "inputToOutputWeights");
3243 
3244  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
3245  "inputToInputWeights", "recurrentToInputWeights");
3246  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
3247  "inputToInputWeights", "recurrentToForgeteights");
3248  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
3249  "inputToInputWeights", "recurrentToCellWeights");
3250  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
3251  "inputToInputWeights", "recurrentToOutputWeights");
3252 
3253  // Validate matching quantization info for weight tensors (all should match each other)
3254  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
3255  descriptorName, "inputToInputWeights", "inputToForgetWeights");
3256  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
3257  descriptorName, "inputToInputWeights", "inputToCellWeights");
3258  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
3259  descriptorName, "inputToInputWeights", "inputToOutputWeights");
3260 
3261  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
3262  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
3263  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
3264  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
3265  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
3266  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
3267  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
3268  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
3269 
3270  // Validate number of dimensions and number of elements in bias tensors
3271  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
3272  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
3273  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
3274 
3275  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
3276  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
3277  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
3278 
3279  ValidatePointer(m_CellBias, descriptorName, "CellBias");
3280  auto cellBiasInfo = m_CellBias->GetTensorInfo();
3281  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
3282 
3283  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
3284  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
3285  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
3286 
3287  // Validate data types for bias tensors (all should match each other)
3288  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
3289 
3290  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
3291  "inputGateBias", "forgetGateBias");
3292  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
3293  "inputGateBias", "cellBias");
3294  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
3295  "inputGateBias", "outputGateBias");
3296 
3297  // Validate bias tensor quantization info
3298  ValidateBiasTensorQuantization(inputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3299  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3300  ValidateBiasTensorQuantization(cellBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3301  ValidateBiasTensorQuantization(outputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
3302 }
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 606 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstCpuTensorHandle* m_ForgetGateBias

Definition at line 605 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstCpuTensorHandle* m_InputGateBias

Definition at line 604 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstCpuTensorHandle* m_InputToCellWeights

Definition at line 596 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstCpuTensorHandle* m_InputToForgetWeights

Definition at line 595 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstCpuTensorHandle* m_InputToInputWeights

Definition at line 594 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstCpuTensorHandle* m_InputToOutputWeights

Definition at line 597 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstCpuTensorHandle* m_OutputGateBias

Definition at line 607 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstCpuTensorHandle* m_RecurrentToCellWeights

Definition at line 601 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstCpuTensorHandle* m_RecurrentToForgetWeights

Definition at line 600 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstCpuTensorHandle* m_RecurrentToInputWeights

Definition at line 599 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstCpuTensorHandle* m_RecurrentToOutputWeights

Definition at line 602 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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