ArmNN
 20.11
DepthwiseConvolution2dQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for DepthwiseConvolution2dQueueDescriptor:
QueueDescriptorWithParameters< DepthwiseConvolution2dDescriptor > QueueDescriptor

Public Member Functions

 DepthwiseConvolution2dQueueDescriptor ()
 
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 ConstCpuTensorHandlem_Weight
 
const ConstCpuTensorHandlem_Bias
 
- Public Attributes inherited from QueueDescriptorWithParameters< DepthwiseConvolution2dDescriptor >
DepthwiseConvolution2dDescriptor 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< DepthwiseConvolution2dDescriptor >
 ~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 207 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ DepthwiseConvolution2dQueueDescriptor()

Definition at line 209 of file WorkloadData.hpp.

210  : m_Weight(nullptr)
211  , m_Bias(nullptr)
212  {
213  }

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1297 of file WorkloadData.cpp.

References armnn::BFloat16, armnn::Float16, armnn::Float32, armnn::GetBiasDataType(), TensorInfo::GetDataType(), TensorInfo::GetShape(), WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, armnn::NCHW, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

1298 {
1299  const std::string descriptorName{"DepthwiseConvolution2dQueueDescriptor"};
1300 
1301  ValidateNumInputs(workloadInfo, descriptorName, 1);
1302  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1303 
1304  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1305  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1306 
1307  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1308  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1309 
1310  ValidatePointer(m_Weight, descriptorName, "weight");
1311 
1312  const TensorInfo& weightTensorInfo = m_Weight->GetTensorInfo();
1313  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1314 
1316  {
1318  fmt::format("{}: dilationX (provided {}) and dilationY (provided {}) "
1319  "cannot be smaller than 1.",
1320  descriptorName, m_Parameters.m_DilationX, m_Parameters.m_DilationX));
1321  }
1322 
1323  const unsigned int channelIndex = (m_Parameters.m_DataLayout == DataLayout::NCHW) ? 1 : 3;
1324 
1325  // Expected weight shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
1326  // inputChannels * channelMultiplier should be equal to outputChannels.
1327  const unsigned int numWeightChannelMultiplier = weightTensorInfo.GetShape()[0];
1328  const unsigned int numWeightInputChannels = weightTensorInfo.GetShape()[1];
1329  const unsigned int numWeightOutputChannels = outputTensorInfo.GetShape()[channelIndex];
1330  if (numWeightChannelMultiplier * numWeightInputChannels != numWeightOutputChannels)
1331  {
1332  throw InvalidArgumentException(fmt::format(
1333  "{0}: output_channels (provided {1}) should be equal to input_channels (provided {2}) "
1334  "multiplied by channel_multiplier (provided {3}).",
1335  descriptorName, numWeightOutputChannels, numWeightInputChannels, numWeightChannelMultiplier));
1336  }
1337 
1338  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1339 
1340  Optional<TensorInfo> optionalBiasTensorInfo;
1342  {
1343  ValidatePointer(m_Bias, descriptorName, "bias");
1344 
1345  optionalBiasTensorInfo = MakeOptional<TensorInfo>(m_Bias->GetTensorInfo());
1346  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1347 
1348  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1349  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1350  }
1351  ValidatePerAxisQuantization(inputTensorInfo,
1352  outputTensorInfo,
1353  weightTensorInfo,
1354  optionalBiasTensorInfo,
1355  descriptorName);
1356 
1357  std::vector<DataType> supportedTypes =
1358  {
1365  };
1366 
1367  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1368  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1369 }
bool m_BiasEnabled
Enable/disable bias.
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_DilationY
Dilation factor value for height dimension.
std::vector< TensorInfo > m_InputTensorInfos
uint32_t m_DilationX
Dilation factor value for width dimension.
DataType GetDataType() const
Definition: Tensor.hpp:194
std::vector< TensorInfo > m_OutputTensorInfos
DataType GetBiasDataType(DataType inputDataType)
const TensorInfo & GetTensorInfo() const

Member Data Documentation

◆ m_Bias

◆ m_Weight


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