ArmNN
 21.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
 
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 1305 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().

1306 {
1307  const std::string descriptorName{"DepthwiseConvolution2dQueueDescriptor"};
1308 
1309  ValidateNumInputs(workloadInfo, descriptorName, 1);
1310  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1311 
1312  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1313  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1314 
1315  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1316  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1317 
1318  ValidatePointer(m_Weight, descriptorName, "weight");
1319 
1320  const TensorInfo& weightTensorInfo = m_Weight->GetTensorInfo();
1321  ValidateTensorNumDimensions(weightTensorInfo, descriptorName, 4, "weight");
1322 
1324  {
1326  fmt::format("{}: dilationX (provided {}) and dilationY (provided {}) "
1327  "cannot be smaller than 1.",
1328  descriptorName, m_Parameters.m_DilationX, m_Parameters.m_DilationX));
1329  }
1330 
1331  if (m_Parameters.m_StrideX <= 0 || m_Parameters.m_StrideY <= 0 )
1332  {
1334  fmt::format("{}: strideX (provided {}) and strideY (provided {}) "
1335  "cannot be either negative or 0.",
1336  descriptorName, m_Parameters.m_StrideX, m_Parameters.m_StrideY));
1337  }
1338 
1339  const unsigned int channelIndex = (m_Parameters.m_DataLayout == DataLayout::NCHW) ? 1 : 3;
1340 
1341  // Expected weight shape: [ M, I, H, W ] - This shape does NOT depend on the data layout
1342  // inputChannels * channelMultiplier should be equal to outputChannels.
1343  const unsigned int numWeightChannelMultiplier = weightTensorInfo.GetShape()[0];
1344  const unsigned int numWeightInputChannels = weightTensorInfo.GetShape()[1];
1345  const unsigned int numWeightOutputChannels = outputTensorInfo.GetShape()[channelIndex];
1346  if (numWeightChannelMultiplier * numWeightInputChannels != numWeightOutputChannels)
1347  {
1348  throw InvalidArgumentException(fmt::format(
1349  "{0}: output_channels (provided {1}) should be equal to input_channels (provided {2}) "
1350  "multiplied by channel_multiplier (provided {3}).",
1351  descriptorName, numWeightOutputChannels, numWeightInputChannels, numWeightChannelMultiplier));
1352  }
1353 
1354  ValidateWeightDataType(inputTensorInfo, weightTensorInfo, descriptorName);
1355 
1356  Optional<TensorInfo> optionalBiasTensorInfo;
1358  {
1359  ValidatePointer(m_Bias, descriptorName, "bias");
1360 
1361  optionalBiasTensorInfo = MakeOptional<TensorInfo>(m_Bias->GetTensorInfo());
1362  const TensorInfo& biasTensorInfo = optionalBiasTensorInfo.value();
1363 
1364  ValidateBiasTensorQuantization(biasTensorInfo, inputTensorInfo, weightTensorInfo, descriptorName);
1365  ValidateTensorDataType(biasTensorInfo, GetBiasDataType(inputTensorInfo.GetDataType()), descriptorName, "bias");
1366  }
1367  ValidatePerAxisQuantization(inputTensorInfo,
1368  outputTensorInfo,
1369  weightTensorInfo,
1370  optionalBiasTensorInfo,
1371  descriptorName);
1372 
1373  std::vector<DataType> supportedTypes =
1374  {
1381  };
1382 
1383  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1384  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1385 }
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_StrideX
Stride value when proceeding through input for the width dimension.
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)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
const TensorInfo & GetTensorInfo() const

Member Data Documentation

◆ m_Bias

◆ m_Weight


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