ArmNN
 20.02
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 1212 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().

1213 {
1214  const std::string descriptorName{"DepthwiseConvolution2dQueueDescriptor"};
1215 
1216  ValidateNumInputs(workloadInfo, descriptorName, 1);
1217  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1218 
1219  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1220  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1221 
1222  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1223  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1224 
1225  ValidatePointer(m_Weight, descriptorName, "weight");
1226 
1227  const TensorInfo& weightTensorInfo = m_Weight->GetTensorInfo();
1228  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1229 
1231  {
1233  boost::str(boost::format("%1%: dilationX (provided %2%) and dilationY (provided %3%) "
1234  "cannot be smaller than 1.") % descriptorName %
1236  }
1237 
1238  const unsigned int channelIndex = (m_Parameters.m_DataLayout == DataLayout::NCHW) ? 1 : 3;
1239 
1240  // Expected weight shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
1241  // inputChannels * channelMultiplier should be equal to outputChannels.
1242  const unsigned int numWeightChannelMultiplier = weightTensorInfo.GetShape()[0];
1243  const unsigned int numWeightInputChannels = weightTensorInfo.GetShape()[1];
1244  const unsigned int numWeightOutputChannels = outputTensorInfo.GetShape()[channelIndex];
1245  if (numWeightChannelMultiplier * numWeightInputChannels != numWeightOutputChannels)
1246  {
1248  boost::str(boost::format("%1%: output_channels (provided %2%) should be "
1249  "equal to input_channels (provided %3%) multiplied by channel_multiplier "
1250  "(provided %4%).") % descriptorName % numWeightOutputChannels %
1251  numWeightInputChannels % numWeightChannelMultiplier));
1252  }
1253 
1254  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1255 
1256  Optional<TensorInfo> optionalBiasTensorInfo;
1258  {
1259  ValidatePointer(m_Bias, descriptorName, "bias");
1260 
1261  optionalBiasTensorInfo = MakeOptional<TensorInfo>(m_Bias->GetTensorInfo());
1262  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1263 
1264  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1265  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1266  }
1267  ValidatePerAxisQuantization(inputTensorInfo,
1268  outputTensorInfo,
1269  weightTensorInfo,
1270  optionalBiasTensorInfo,
1271  descriptorName);
1272 
1273  std::vector<DataType> supportedTypes =
1274  {
1281  };
1282 
1283  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1284  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1285 }
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: