ArmNN
 20.05
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 183 of file WorkloadData.hpp.

Constructor & Destructor Documentation

◆ DepthwiseConvolution2dQueueDescriptor()

Definition at line 185 of file WorkloadData.hpp.

186  : m_Weight(nullptr)
187  , m_Bias(nullptr)
188  {
189  }

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

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

1244 {
1245  const std::string descriptorName{"DepthwiseConvolution2dQueueDescriptor"};
1246 
1247  ValidateNumInputs(workloadInfo, descriptorName, 1);
1248  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1249 
1250  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1251  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1252 
1253  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1254  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1255 
1256  ValidatePointer(m_Weight, descriptorName, "weight");
1257 
1258  const TensorInfo& weightTensorInfo = m_Weight->GetTensorInfo();
1259  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1260 
1262  {
1264  boost::str(boost::format("%1%: dilationX (provided %2%) and dilationY (provided %3%) "
1265  "cannot be smaller than 1.") % descriptorName %
1267  }
1268 
1269  const unsigned int channelIndex = (m_Parameters.m_DataLayout == DataLayout::NCHW) ? 1 : 3;
1270 
1271  // Expected weight shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
1272  // inputChannels * channelMultiplier should be equal to outputChannels.
1273  const unsigned int numWeightChannelMultiplier = weightTensorInfo.GetShape()[0];
1274  const unsigned int numWeightInputChannels = weightTensorInfo.GetShape()[1];
1275  const unsigned int numWeightOutputChannels = outputTensorInfo.GetShape()[channelIndex];
1276  if (numWeightChannelMultiplier * numWeightInputChannels != numWeightOutputChannels)
1277  {
1279  boost::str(boost::format("%1%: output_channels (provided %2%) should be "
1280  "equal to input_channels (provided %3%) multiplied by channel_multiplier "
1281  "(provided %4%).") % descriptorName % numWeightOutputChannels %
1282  numWeightInputChannels % numWeightChannelMultiplier));
1283  }
1284 
1285  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1286 
1287  Optional<TensorInfo> optionalBiasTensorInfo;
1289  {
1290  ValidatePointer(m_Bias, descriptorName, "bias");
1291 
1292  optionalBiasTensorInfo = MakeOptional<TensorInfo>(m_Bias->GetTensorInfo());
1293  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1294 
1295  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1296  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1297  }
1298  ValidatePerAxisQuantization(inputTensorInfo,
1299  outputTensorInfo,
1300  weightTensorInfo,
1301  optionalBiasTensorInfo,
1302  descriptorName);
1303 
1304  std::vector<DataType> supportedTypes =
1305  {
1312  };
1313 
1314  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1315  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1316 }
bool m_BiasEnabled
Enable/disable bias.
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
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:95
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: