ArmNN
 20.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
 

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 512 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ QuantizedLstmQueueDescriptor()

Definition at line 514 of file WorkloadData.hpp.

515  : m_InputToInputWeights(nullptr)
516  , m_InputToForgetWeights(nullptr)
517  , m_InputToCellWeights(nullptr)
518  , m_InputToOutputWeights(nullptr)
519 
520  , m_RecurrentToInputWeights(nullptr)
521  , m_RecurrentToForgetWeights(nullptr)
522  , m_RecurrentToCellWeights(nullptr)
523  , m_RecurrentToOutputWeights(nullptr)
524 
525  , m_InputGateBias(nullptr)
526  , m_ForgetGateBias(nullptr)
527  , m_CellBias(nullptr)
528  , m_OutputGateBias(nullptr)
529  {}
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 2754 of file WorkloadData.cpp.

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

2755 {
2756  const std::string descriptorName{"QuantizedLstmQueueDescriptor"};
2757 
2758  // Validate number of inputs/outputs
2759  ValidateNumInputs(workloadInfo, descriptorName, 3);
2760  ValidateNumOutputs(workloadInfo, descriptorName, 2);
2761 
2762  // Input/output tensor infos
2763  auto inputInfo = workloadInfo.m_InputTensorInfos[0];
2764  auto cellStateInInfo = workloadInfo.m_InputTensorInfos[1];
2765  auto outputStateInInfo = workloadInfo.m_InputTensorInfos[2];
2766 
2767  auto cellStateOutInfo = workloadInfo.m_OutputTensorInfos[0];
2768  auto outputStateOutInfo = workloadInfo.m_OutputTensorInfos[1];
2769 
2770  std::vector<DataType> inputOutputSupportedTypes =
2771  {
2773  };
2774 
2775  std::vector<DataType> cellStateSupportedTypes =
2776  {
2778  };
2779 
2780  std::vector<DataType> weightsSupportedTypes =
2781  {
2783  };
2784 
2785  std::vector<DataType> biasSupportedTypes =
2786  {
2788  };
2789 
2790  // Validate types of input/output tensors
2791  ValidateDataTypes(inputInfo, inputOutputSupportedTypes, descriptorName);
2792  ValidateDataTypes(cellStateInInfo, cellStateSupportedTypes, descriptorName);
2793  ValidateDataTypes(outputStateInInfo, inputOutputSupportedTypes, descriptorName);
2794 
2795  ValidateDataTypes(cellStateOutInfo, cellStateSupportedTypes, descriptorName);
2796  ValidateDataTypes(outputStateOutInfo, inputOutputSupportedTypes, descriptorName);
2797 
2798  // Validate matching types of input/output tensors
2799  ValidateTensorDataTypesMatch(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
2800  ValidateTensorDataTypesMatch(outputStateInInfo, outputStateOutInfo, descriptorName,
2801  "outputStateIn", "outputStateOut");
2802  ValidateTensorDataTypesMatch(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
2803 
2804  // Validate matching quantization info for input/output tensors
2805  ValidateTensorQuantizationSpace(inputInfo, outputStateInInfo, descriptorName, "input", "outputStateIn");
2806  ValidateTensorQuantizationSpace(inputInfo, outputStateOutInfo, descriptorName, "input", "outputStateOut");
2807  ValidateTensorQuantizationSpace(cellStateInInfo, cellStateOutInfo, descriptorName, "cellStateIn", "cellStateOut");
2808 
2809  // Infer number of batches, input size and output size from tensor dimensions
2810  const uint32_t numBatches = inputInfo.GetShape()[0];
2811  const uint32_t inputSize = inputInfo.GetShape()[1];
2812  const uint32_t outputSize = cellStateInInfo.GetShape()[1];
2813 
2814  // Validate number of dimensions and number of elements for input/output tensors
2815  ValidateTensorNumDimNumElem(inputInfo, 2, (numBatches * inputSize), descriptorName + " input");
2816  ValidateTensorNumDimNumElem(cellStateInInfo, 2, (numBatches * outputSize), descriptorName + " cellStateIn");
2817  ValidateTensorNumDimNumElem(outputStateInInfo, 2, (numBatches * outputSize), descriptorName + " outputStateIn");
2818  ValidateTensorNumDimNumElem(cellStateOutInfo, 2, (numBatches * outputSize), descriptorName + " cellStateOut");
2819  ValidateTensorNumDimNumElem(outputStateOutInfo, 2, (numBatches * outputSize), descriptorName + " outputStateOut");
2820 
2821  // Validate number of dimensions and number of elements for weights tensors
2822  ValidatePointer(m_InputToInputWeights, descriptorName, "InputToInputWeights");
2823  auto inputToInputWeightsInfo = m_InputToInputWeights->GetTensorInfo();
2824  ValidateTensorNumDimNumElem(inputToInputWeightsInfo, 2, (outputSize * inputSize), " InputToInputWeights");
2825 
2826  ValidatePointer(m_InputToForgetWeights, descriptorName, "InputToForgetWeights");
2827  auto inputToForgetWeightsInfo = m_InputToForgetWeights->GetTensorInfo();
2828  ValidateTensorNumDimNumElem(inputToForgetWeightsInfo, 2, (outputSize * inputSize), " InputToForgetWeights");
2829 
2830  ValidatePointer(m_InputToCellWeights, descriptorName, "InputToCellWeights");
2831  auto inputToCellWeightsInfo = m_InputToCellWeights->GetTensorInfo();
2832  ValidateTensorNumDimNumElem(inputToCellWeightsInfo, 2, (outputSize * inputSize), " InputToCellWeights");
2833 
2834  ValidatePointer(m_InputToOutputWeights, descriptorName, "InputToOutputWeights");
2835  auto inputToOutputWeightsInfo = m_InputToOutputWeights->GetTensorInfo();
2836  ValidateTensorNumDimNumElem(inputToOutputWeightsInfo, 2, (outputSize * inputSize), " InputToOutputWeights");
2837 
2838  ValidatePointer(m_RecurrentToInputWeights, descriptorName, "RecurrentToInputWeights");
2839  auto recurrentToInputWeightsInfo = m_RecurrentToInputWeights->GetTensorInfo();
2840  ValidateTensorNumDimNumElem(recurrentToInputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToInputWeights");
2841 
2842  ValidatePointer(m_RecurrentToForgetWeights, descriptorName, "RecurrentToForgetWeights");
2843  auto recurrentToForgetWeightsInfo = m_RecurrentToForgetWeights->GetTensorInfo();
2844  ValidateTensorNumDimNumElem(recurrentToForgetWeightsInfo, 2, (outputSize * outputSize),
2845  " RecurrentToForgetWeights");
2846 
2847  ValidatePointer(m_RecurrentToCellWeights, descriptorName, "RecurrentToCellWeights");
2848  auto recurrentToCellWeightsInfo = m_RecurrentToCellWeights->GetTensorInfo();
2849  ValidateTensorNumDimNumElem(recurrentToCellWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
2850 
2851  ValidatePointer(m_RecurrentToOutputWeights, descriptorName, "RecurrentToOutputWeights");
2852  auto recurrentToOutputWeightsInfo = m_RecurrentToOutputWeights->GetTensorInfo();
2853  ValidateTensorNumDimNumElem(recurrentToOutputWeightsInfo, 2, (outputSize * outputSize), " RecurrentToCellWeights");
2854 
2855  // Validate data types for weights tensors (all should match each other)
2856  ValidateDataTypes(inputToInputWeightsInfo, weightsSupportedTypes, descriptorName);
2857 
2858  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToForgetWeightsInfo, descriptorName,
2859  "inputToInputWeights", "inputToForgetWeights");
2860  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToCellWeightsInfo, descriptorName,
2861  "inputToInputWeights", "inputToCellWeights");
2862  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, inputToOutputWeightsInfo, descriptorName,
2863  "inputToInputWeights", "inputToOutputWeights");
2864 
2865  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToInputWeightsInfo, descriptorName,
2866  "inputToInputWeights", "recurrentToInputWeights");
2867  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToForgetWeightsInfo, descriptorName,
2868  "inputToInputWeights", "recurrentToForgeteights");
2869  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToCellWeightsInfo, descriptorName,
2870  "inputToInputWeights", "recurrentToCellWeights");
2871  ValidateTensorDataTypesMatch(inputToInputWeightsInfo, recurrentToOutputWeightsInfo, descriptorName,
2872  "inputToInputWeights", "recurrentToOutputWeights");
2873 
2874  // Validate matching quantization info for weight tensors (all should match each other)
2875  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToForgetWeightsInfo,
2876  descriptorName, "inputToInputWeights", "inputToForgetWeights");
2877  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToCellWeightsInfo,
2878  descriptorName, "inputToInputWeights", "inputToCellWeights");
2879  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, inputToOutputWeightsInfo,
2880  descriptorName, "inputToInputWeights", "inputToOutputWeights");
2881 
2882  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToInputWeightsInfo,
2883  descriptorName, "inputToInputWeights", "recurrentToInputWeights");
2884  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToForgetWeightsInfo,
2885  descriptorName, "inputToInputWeights", "recurrentToForgetWeights");
2886  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToCellWeightsInfo,
2887  descriptorName, "inputToInputWeights", "recurrentToCellWeights");
2888  ValidateTensorQuantizationSpace(inputToInputWeightsInfo, recurrentToOutputWeightsInfo,
2889  descriptorName, "inputToInputWeights", "recurrentToOutputWeights");
2890 
2891  // Validate number of dimensions and number of elements in bias tensors
2892  ValidatePointer(m_InputGateBias, descriptorName, "InputGateBias");
2893  auto inputGateBiasInfo = m_InputGateBias->GetTensorInfo();
2894  ValidateTensorNumDimNumElem(inputGateBiasInfo, 1, outputSize, " InputGateBias");
2895 
2896  ValidatePointer(m_ForgetGateBias, descriptorName, "ForgetGateBias");
2897  auto forgetGateBiasInfo = m_ForgetGateBias->GetTensorInfo();
2898  ValidateTensorNumDimNumElem(forgetGateBiasInfo, 1, outputSize, " ForgetGateBias");
2899 
2900  ValidatePointer(m_CellBias, descriptorName, "CellBias");
2901  auto cellBiasInfo = m_CellBias->GetTensorInfo();
2902  ValidateTensorNumDimNumElem(cellBiasInfo, 1, outputSize, " CellBias");
2903 
2904  ValidatePointer(m_OutputGateBias, descriptorName, "OutputGateBias");
2905  auto outputGateBiasInfo = m_OutputGateBias->GetTensorInfo();
2906  ValidateTensorNumDimNumElem(outputGateBiasInfo, 1, outputSize, " OutputGateBias");
2907 
2908  // Validate data types for bias tensors (all should match each other)
2909  ValidateDataTypes(inputGateBiasInfo, biasSupportedTypes, descriptorName);
2910 
2911  ValidateTensorDataTypesMatch(inputGateBiasInfo, forgetGateBiasInfo, descriptorName,
2912  "inputGateBias", "forgetGateBias");
2913  ValidateTensorDataTypesMatch(inputGateBiasInfo, cellBiasInfo, descriptorName,
2914  "inputGateBias", "cellBias");
2915  ValidateTensorDataTypesMatch(inputGateBiasInfo, outputGateBiasInfo, descriptorName,
2916  "inputGateBias", "outputGateBias");
2917 
2918  // Validate bias tensor quantization info
2919  ValidateBiasTensorQuantization(inputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
2920  ValidateBiasTensorQuantization(forgetGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
2921  ValidateBiasTensorQuantization(cellBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
2922  ValidateBiasTensorQuantization(outputGateBiasInfo, inputInfo, inputToInputWeightsInfo, descriptorName);
2923 }
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 543 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_ForgetGateBias

const ConstCpuTensorHandle* m_ForgetGateBias

Definition at line 542 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputGateBias

const ConstCpuTensorHandle* m_InputGateBias

Definition at line 541 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToCellWeights

const ConstCpuTensorHandle* m_InputToCellWeights

Definition at line 533 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToForgetWeights

const ConstCpuTensorHandle* m_InputToForgetWeights

Definition at line 532 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToInputWeights

const ConstCpuTensorHandle* m_InputToInputWeights

Definition at line 531 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_InputToOutputWeights

const ConstCpuTensorHandle* m_InputToOutputWeights

Definition at line 534 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_OutputGateBias

const ConstCpuTensorHandle* m_OutputGateBias

Definition at line 544 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToCellWeights

const ConstCpuTensorHandle* m_RecurrentToCellWeights

Definition at line 538 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToForgetWeights

const ConstCpuTensorHandle* m_RecurrentToForgetWeights

Definition at line 537 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToInputWeights

const ConstCpuTensorHandle* m_RecurrentToInputWeights

Definition at line 536 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().

◆ m_RecurrentToOutputWeights

const ConstCpuTensorHandle* m_RecurrentToOutputWeights

Definition at line 539 of file WorkloadData.hpp.

Referenced by QuantizedLstmLayer::CreateWorkload().


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