ArmNN
 20.08
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
 

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
 

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 ()=default
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 189 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ DepthwiseConvolution2dQueueDescriptor()

Definition at line 191 of file WorkloadData.hpp.

192  : m_Weight(nullptr)
193  , m_Bias(nullptr)
194  {
195  }

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1268 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().

1269 {
1270  const std::string descriptorName{"DepthwiseConvolution2dQueueDescriptor"};
1271 
1272  ValidateNumInputs(workloadInfo, descriptorName, 1);
1273  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1274 
1275  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1276  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1277 
1278  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1279  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1280 
1281  ValidatePointer(m_Weight, descriptorName, "weight");
1282 
1283  const TensorInfo& weightTensorInfo = m_Weight->GetTensorInfo();
1284  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1285 
1287  {
1289  boost::str(boost::format("%1%: dilationX (provided %2%) and dilationY (provided %3%) "
1290  "cannot be smaller than 1.") % descriptorName %
1292  }
1293 
1294  const unsigned int channelIndex = (m_Parameters.m_DataLayout == DataLayout::NCHW) ? 1 : 3;
1295 
1296  // Expected weight shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
1297  // inputChannels * channelMultiplier should be equal to outputChannels.
1298  const unsigned int numWeightChannelMultiplier = weightTensorInfo.GetShape()[0];
1299  const unsigned int numWeightInputChannels = weightTensorInfo.GetShape()[1];
1300  const unsigned int numWeightOutputChannels = outputTensorInfo.GetShape()[channelIndex];
1301  if (numWeightChannelMultiplier * numWeightInputChannels != numWeightOutputChannels)
1302  {
1304  boost::str(boost::format("%1%: output_channels (provided %2%) should be "
1305  "equal to input_channels (provided %3%) multiplied by channel_multiplier "
1306  "(provided %4%).") % descriptorName % numWeightOutputChannels %
1307  numWeightInputChannels % numWeightChannelMultiplier));
1308  }
1309 
1310  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1311 
1312  Optional<TensorInfo> optionalBiasTensorInfo;
1314  {
1315  ValidatePointer(m_Bias, descriptorName, "bias");
1316 
1317  optionalBiasTensorInfo = MakeOptional<TensorInfo>(m_Bias->GetTensorInfo());
1318  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1319 
1320  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1321  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1322  }
1323  ValidatePerAxisQuantization(inputTensorInfo,
1324  outputTensorInfo,
1325  weightTensorInfo,
1326  optionalBiasTensorInfo,
1327  descriptorName);
1328 
1329  std::vector<DataType> supportedTypes =
1330  {
1337  };
1338 
1339  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1340  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1341 }
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: