ArmNN
 21.11
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 1034 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.

1035 {
1036  const std::string descriptorName{"FullyConnectedQueueDescriptor"};
1037 
1038  uint32_t numInputs = 2;
1040  {
1041  numInputs = 3;
1042  }
1043 
1044  ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1045  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1046 
1047  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1048  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1049 
1050  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 2, "output");
1051 
1052  if (!(inputTensorInfo.GetNumDimensions() == 2 || inputTensorInfo.GetNumDimensions() == 4))
1053  {
1054  throw InvalidArgumentException(descriptorName + ": Input tensor must have 2 or 4 dimensions.");
1055  }
1056 
1057  TensorInfo weightTensorInfo = workloadInfo.m_InputTensorInfos[1];
1058  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 2, "weight");
1059 
1061  {
1062  TensorInfo biasTensorInfo = workloadInfo.m_InputTensorInfos[2];
1063  // Validates type and quantization values.
1064  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1065  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1066  ValidateTensorNumDimensions(biasTensorInfo, descriptorName, 1, "bias");
1067  }
1068 
1069  // Check the supported data types
1070  std::vector<DataType> supportedTypes =
1071  {
1078  };
1079 
1080  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1081 
1082  // For FullyConnected, we allow to have BFloat16 input with Float32 output for optimization.
1083  if (inputTensorInfo.GetDataType() == DataType::BFloat16)
1084  {
1085  if (outputTensorInfo.GetDataType() != DataType::BFloat16 && outputTensorInfo.GetDataType() != DataType::Float32)
1086  {
1087  throw InvalidArgumentException(descriptorName + ": " + " Output tensor type must be BFloat16 or Float32 "
1088  "for BFloat16 input.");
1089  }
1090  }
1091  else
1092  {
1093  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1094  }
1095 }
std::vector< TensorInfo > m_InputTensorInfos
DataType GetDataType() const
Definition: Tensor.hpp:198
bool m_BiasEnabled
Enable/disable bias.
std::vector< TensorInfo > m_OutputTensorInfos
DataType GetBiasDataType(DataType inputDataType)
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:195

Member Data Documentation

◆ m_Bias

◆ m_Weight


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