ArmNN
 24.08
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 1252 of file WorkloadData.cpp.

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

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:398
armnn::OptionalReferenceSwitch< std::is_reference< T >::value, T >::value
const T & value() const
Definition: Optional.hpp:146