ArmNN
 24.02
Convolution2dQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

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

Public Member Functions

void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< Convolution2dDescriptor >
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< Convolution2dDescriptor >
Convolution2dDescriptor 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< Convolution2dDescriptor >
 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 210 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1249 of file WorkloadData.cpp.

1250 {
1251  const std::string descriptorName{"Convolution2dQueueDescriptor"};
1252 
1253  uint32_t numInputs = 2;
1255  {
1256  numInputs = 3;
1257  }
1258 
1259  ValidateNumInputs(workloadInfo, descriptorName, numInputs);
1260  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1261 
1262  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1263  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1264 
1265  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1266  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1267 
1268  const TensorInfo& weightTensorInfo = workloadInfo.m_InputTensorInfos[1];
1269 
1270  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1271 
1272  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1273 
1274  Optional<TensorInfo> optionalBiasTensorInfo;
1276  {
1277  optionalBiasTensorInfo = MakeOptional<TensorInfo>(workloadInfo.m_InputTensorInfos[2]);
1278  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1279 
1280  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1281  ValidateBiasTensorQuantization(biasTensorInfo, weightTensorInfo, descriptorName);
1282  }
1283 
1284  if (m_Parameters.m_StrideX <= 0 || m_Parameters.m_StrideY <= 0 )
1285  {
1287  fmt::format("{}: strideX (provided {}) and strideY (provided {}) "
1288  "cannot be either negative or 0.",
1289  descriptorName, m_Parameters.m_StrideX, m_Parameters.m_StrideY));
1290  }
1291 
1292  ValidatePerAxisQuantization(inputTensorInfo,
1293  outputTensorInfo,
1294  weightTensorInfo,
1295  optionalBiasTensorInfo,
1296  descriptorName);
1297 
1298  std::vector<DataType> supportedTypes =
1299  {
1307  };
1308 
1309  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1310 
1311  // For Convolution2d, we allow to have BFloat16 input with Float32 output for optimization.
1312  if (inputTensorInfo.GetDataType() == DataType::BFloat16)
1313  {
1314  if (outputTensorInfo.GetDataType() != DataType::BFloat16 && outputTensorInfo.GetDataType() != DataType::Float32)
1315  {
1316  throw InvalidArgumentException(descriptorName + ": " + " Output tensor type must be BFloat16 or Float32 "
1317  "for BFloat16 input.");
1318  }
1319  }
1320  else
1321  {
1322  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1323  }
1324 }

References armnn::BFloat16, armnn::Float16, armnn::Float32, armnn::GetBiasDataType(), TensorInfo::GetDataType(), Convolution2dDescriptor::m_BiasEnabled, WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< Convolution2dDescriptor >::m_Parameters, Convolution2dDescriptor::m_StrideX, Convolution2dDescriptor::m_StrideY, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::QSymmS8, QueueDescriptor::ValidateTensorNumDimensions(), and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().


The documentation for this struct was generated from the following files:
armnn::Optional
Definition: Optional.hpp:270
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::DataType::Float32
@ Float32
armnn::Convolution2dDescriptor::m_StrideY
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
Definition: Descriptors.hpp:576
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::DataType::QSymmS8
@ QSymmS8
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< Convolution2dDescriptor >::m_Parameters
Convolution2dDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::Convolution2dDescriptor::m_BiasEnabled
bool m_BiasEnabled
Enable/disable bias.
Definition: Descriptors.hpp:582
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::Convolution2dDescriptor::m_StrideX
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
Definition: Descriptors.hpp:574
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
armnn::OptionalReferenceSwitch< std::is_reference< T >::value, T >::value
const T & value() const
Definition: Optional.hpp:146