ArmNN
 24.08
SpaceToDepthQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for SpaceToDepthQueueDescriptor:
[legend]
Collaboration diagram for SpaceToDepthQueueDescriptor:
[legend]

Public Member Functions

void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< SpaceToDepthDescriptor >
virtual ~QueueDescriptorWithParameters ()=default
 
- Public Member Functions inherited from QueueDescriptor
virtual ~QueueDescriptor ()=default
 
void ValidateTensorNumDimensions (const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
 
void ValidateTensorNumDimNumElem (const TensorInfo &tensorInfo, unsigned int numDimension, unsigned int numElements, std::string const &tensorName) const
 
void ValidateInputsOutputs (const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
 
template<typename T >
const T * GetAdditionalInformation () const
 

Additional Inherited Members

- Public Attributes inherited from QueueDescriptorWithParameters< SpaceToDepthDescriptor >
SpaceToDepthDescriptor m_Parameters
 
- Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
 
std::vector< ITensorHandle * > m_Outputs
 
void * m_AdditionalInfoObject
 
bool m_AllowExpandedDims = false
 
- Protected Member Functions inherited from QueueDescriptorWithParameters< SpaceToDepthDescriptor >
 QueueDescriptorWithParameters ()=default
 
 QueueDescriptorWithParameters (QueueDescriptorWithParameters const &)=default
 
QueueDescriptorWithParametersoperator= (QueueDescriptorWithParameters const &)=default
 
- Protected Member Functions inherited from QueueDescriptor
 QueueDescriptor ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 390 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 1937 of file WorkloadData.cpp.

1938 {
1939  const std::string descriptorName{"SpaceToDepthQueueDescriptor"};
1940 
1941  ValidateNumInputs(workloadInfo, descriptorName, 1);
1942  ValidateNumOutputs(workloadInfo, descriptorName, 1);
1943 
1944  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
1945  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
1946 
1947  ValidateTensorNumDimensions(inputTensorInfo, descriptorName, 4, "input");
1948  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, 4, "output");
1949 
1950  std::vector<DataType> supportedTypes =
1951  {
1958  };
1959 
1960  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
1961  ValidateDataTypes(outputTensorInfo, supportedTypes, descriptorName);
1962 
1963  ValidateTensorNumElementsMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
1964 
1965  if (m_Parameters.m_BlockSize == 0)
1966  {
1967  throw InvalidArgumentException(descriptorName + ": Block size cannot be 0.");
1968  }
1969 
1970  DataLayoutIndexed dimensionIndices(m_Parameters.m_DataLayout);
1971  const unsigned int wIndex = dimensionIndices.GetWidthIndex();
1972  const unsigned int hIndex = dimensionIndices.GetHeightIndex();
1973  const unsigned int cIndex = dimensionIndices.GetChannelsIndex();
1974 
1975  const TensorShape& inputShape = inputTensorInfo.GetShape();
1976  if (inputShape[hIndex] % m_Parameters.m_BlockSize != 0 || inputShape[wIndex] % m_Parameters.m_BlockSize != 0)
1977  {
1978  throw InvalidArgumentException(descriptorName + ": Input shape must be divisible "
1979  "by block size in all spatial dimensions");
1980  }
1981 
1982  const TensorShape& outputShape = outputTensorInfo.GetShape();
1983  if (outputShape[cIndex] % (m_Parameters.m_BlockSize * m_Parameters.m_BlockSize) != 0)
1984  {
1985  throw InvalidArgumentException(descriptorName + ": The depth of the output tensor"
1986  "must be divisible by the square of block size." );
1987  }
1988 }

References armnn::BFloat16, armnn::Float16, armnn::Float32, DataLayoutIndexed::GetChannelsIndex(), DataLayoutIndexed::GetHeightIndex(), TensorInfo::GetShape(), DataLayoutIndexed::GetWidthIndex(), SpaceToDepthDescriptor::m_BlockSize, SpaceToDepthDescriptor::m_DataLayout, WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< SpaceToDepthDescriptor >::m_Parameters, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and QueueDescriptor::ValidateTensorNumDimensions().


The documentation for this struct was generated from the following files:
armnn::TensorInfo
Definition: Tensor.hpp:152
armnnUtils::DataLayoutIndexed
Provides access to the appropriate indexes for Channels, Height and Width based on DataLayout.
Definition: DataLayoutIndexed.hpp:17
armnn::DataType::Float32
@ Float32
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::DataType::QSymmS16
@ QSymmS16
armnn::DataType::BFloat16
@ BFloat16
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::DataType::Float16
@ Float16
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QueueDescriptorWithParameters< SpaceToDepthDescriptor >::m_Parameters
SpaceToDepthDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::DataType::QAsymmS8
@ QAsymmS8
armnn::SpaceToDepthDescriptor::m_BlockSize
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
Definition: Descriptors.hpp:1092
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
armnn::QueueDescriptor::ValidateTensorNumDimensions
void ValidateTensorNumDimensions(const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
Definition: WorkloadData.cpp:398
armnn::SpaceToDepthDescriptor::m_DataLayout
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Definition: Descriptors.hpp:1095