ArmNN
 24.02
FullyConnectedQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for FullyConnectedQueueDescriptor:
[legend]
Collaboration diagram for FullyConnectedQueueDescriptor:
[legend]

Public Member Functions

void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< FullyConnectedDescriptor >
virtual ~QueueDescriptorWithParameters ()=default
 
- Public Member Functions inherited from QueueDescriptor
virtual ~QueueDescriptor ()=default
 
void ValidateTensorNumDimensions (const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
 
void ValidateTensorNumDimNumElem (const TensorInfo &tensorInfo, unsigned int numDimension, unsigned int numElements, std::string const &tensorName) const
 
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
 
template<typename T >
const T * GetAdditionalInformation () const
 

Additional Inherited Members

- 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
 
bool m_AllowExpandedDims = false
 
- Protected Member Functions inherited from QueueDescriptorWithParameters< FullyConnectedDescriptor >
 QueueDescriptorWithParameters ()=default
 
 QueueDescriptorWithParameters (QueueDescriptorWithParameters const &)=default
 
QueueDescriptorWithParametersoperator= (QueueDescriptorWithParameters const &)=default
 
- Protected Member Functions inherited from QueueDescriptor
 QueueDescriptor ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 180 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1033 of file WorkloadData.cpp.

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

References armnn::BFloat16, armnn::Float16, armnn::Float32, armnn::GetBiasDataType(), TensorInfo::GetDataType(), TensorInfo::GetNumDimensions(), FullyConnectedDescriptor::m_BiasEnabled, WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< FullyConnectedDescriptor >::m_Parameters, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and QueueDescriptor::ValidateTensorNumDimensions().


The documentation for this struct was generated from the following files:
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::TensorInfo::GetNumDimensions
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:197
armnn::DataType::Float32
@ Float32
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::DataType::QSymmS16
@ QSymmS16
armnn::DataType::BFloat16
@ BFloat16
armnn::DataType::Float16
@ Float16
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QueueDescriptorWithParameters< FullyConnectedDescriptor >::m_Parameters
FullyConnectedDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::FullyConnectedDescriptor::m_BiasEnabled
bool m_BiasEnabled
Enable/disable bias.
Definition: Descriptors.hpp:526
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::TensorInfo::GetDataType
DataType GetDataType() const
Definition: Tensor.hpp:200
armnn::DataType::QAsymmS8
@ QAsymmS8
armnn::GetBiasDataType
DataType GetBiasDataType(DataType inputDataType)
Definition: WorkloadData.cpp:28
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
armnn::QueueDescriptor::ValidateTensorNumDimensions
void ValidateTensorNumDimensions(const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
Definition: WorkloadData.cpp:397