ArmNN
 21.05
FullyConnectedQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for FullyConnectedQueueDescriptor:
QueueDescriptorWithParameters< FullyConnectedDescriptor > QueueDescriptor

Public Member Functions

 FullyConnectedQueueDescriptor ()
 
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_Weight
 
const ConstTensorHandlem_Bias
 
- Public Attributes inherited from QueueDescriptorWithParameters< FullyConnectedDescriptor >
FullyConnectedDescriptor m_Parameters
 
- 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 QueueDescriptorWithParameters< FullyConnectedDescriptor >
 ~QueueDescriptorWithParameters ()=default
 
 QueueDescriptorWithParameters ()=default
 
 QueueDescriptorWithParameters (QueueDescriptorWithParameters const &)=default
 
QueueDescriptorWithParametersoperator= (QueueDescriptorWithParameters const &)=default
 
- Protected Member Functions inherited from QueueDescriptor
 ~QueueDescriptor ()=default
 
 QueueDescriptor ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 170 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ FullyConnectedQueueDescriptor()

Definition at line 172 of file WorkloadData.hpp.

173  : m_Weight(nullptr)
174  , m_Bias(nullptr)
175  {
176  }
const ConstTensorHandle * m_Bias
const ConstTensorHandle * m_Weight

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1047 of file WorkloadData.cpp.

References armnn::BFloat16, armnn::Float16, armnn::Float32, armnn::GetBiasDataType(), TensorInfo::GetDataType(), TensorInfo::GetNumDimensions(), WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, armnn::QAsymmS8, armnn::QAsymmU8, and armnn::QSymmS16.

1048 {
1049  const std::string descriptorName{"FullyConnectedQueueDescriptor"};
1050 
1051  uint32_t numInputs = 1;
1053  {
1054  numInputs = 2;
1056  {
1057  numInputs = 3;
1058  }
1059  }
1060  ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1061  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1062 
1063  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1064  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1065 
1066  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 2, "output");
1067 
1068  if (!(inputTensorInfo.GetNumDimensions() == 2 || inputTensorInfo.GetNumDimensions() == 4))
1069  {
1070  throw InvalidArgumentException(descriptorName + ": Input tensor must have 2 or 4 dimensions.");
1071  }
1072 
1073  TensorInfo weightTensorInfo;
1075  {
1076  ValidatePointer(m_Weight, descriptorName, "weight");
1077  weightTensorInfo = m_Weight->GetTensorInfo();
1078  }
1079  else
1080  {
1081  weightTensorInfo = workloadInfo.m_InputTensorInfos[1];
1082  }
1083  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 2, "weight");
1084 
1086  {
1087  TensorInfo biasTensorInfo;
1089  {
1090  ValidatePointer(m_Bias, descriptorName, "bias");
1091  biasTensorInfo = m_Bias->GetTensorInfo();
1092  }
1093  else
1094  {
1095  biasTensorInfo = workloadInfo.m_InputTensorInfos[2];
1096  }
1097  // Validates type and quantization values.
1098  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1099  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1100  ValidateTensorNumDimensions(biasTensorInfo, descriptorName, 1, "bias");
1101  }
1102 
1103  // Check the supported data types
1104  std::vector<DataType> supportedTypes =
1105  {
1112  };
1113 
1114  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1115 
1116  // For FullyConnected, we allow to have BFloat16 input with Float32 output for optimization.
1117  if (inputTensorInfo.GetDataType() == DataType::BFloat16)
1118  {
1119  if (outputTensorInfo.GetDataType() != DataType::BFloat16 && outputTensorInfo.GetDataType() != DataType::Float32)
1120  {
1121  throw InvalidArgumentException(descriptorName + ": " + " Output tensor type must be BFloat16 or Float32 "
1122  "for BFloat16 input.");
1123  }
1124  }
1125  else
1126  {
1127  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1128  }
1129 }
const ConstTensorHandle * m_Bias
const TensorInfo & GetTensorInfo() const
std::vector< TensorInfo > m_InputTensorInfos
DataType GetDataType() const
Definition: Tensor.hpp:194
bool m_BiasEnabled
Enable/disable bias.
std::vector< TensorInfo > m_OutputTensorInfos
const ConstTensorHandle * m_Weight
DataType GetBiasDataType(DataType inputDataType)
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:191
bool m_ConstantWeights
Enable/disable constant weights and biases.

Member Data Documentation

◆ m_Bias

◆ m_Weight


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