ArmNN
 24.02
ArgMinMaxQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

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

Public Member Functions

void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< ArgMinMaxDescriptor >
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< ArgMinMaxDescriptor >
ArgMinMaxDescriptor 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< ArgMinMaxDescriptor >
 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 163 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 628 of file WorkloadData.cpp.

629 {
630  const std::string descriptorName{"ArgMinMaxQueueDescriptor"};
631 
632  ValidateNumInputs(workloadInfo, descriptorName, 1);
633  ValidateNumOutputs(workloadInfo, descriptorName, 1);
634 
635  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
636  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
637 
638  if (outputTensorInfo.GetDataType() != DataType::Signed32 &&
639  outputTensorInfo.GetDataType() != DataType::Signed64)
640  {
641  throw InvalidArgumentException(descriptorName + ": Output of ArgMinMax layer must be Int32 or Int64.");
642  }
643 
644  std::vector<DataType> supportedInputTypes =
645  {
654  };
655 
656  ValidateDataTypes(inputTensorInfo, supportedInputTypes, descriptorName);
657 
658  auto inputShape = inputTensorInfo.GetShape();
659  auto outputShape = outputTensorInfo.GetShape();
660 
661  auto inputNumDimensions = inputShape.GetNumDimensions();
662  auto unsignedAxis = armnnUtils::GetUnsignedAxis(inputNumDimensions, m_Parameters.m_Axis);
663 
664  const std::string outputShapeError{": Output tensor shape does not match shape inferred from input tensor."};
665 
666  // 1D input shape results in scalar output shape
667  if (inputShape.GetNumDimensions() == 1)
668  {
669  if (outputShape.GetNumDimensions() != 1 && outputShape[0] != 1)
670  {
671  throw InvalidArgumentException(descriptorName + outputShapeError);
672  }
673  }
674  else
675  {
676  for (unsigned int i = 0; i < unsignedAxis; ++i)
677  {
678  if (outputShape[i] != inputShape[i])
679  {
680  throw InvalidArgumentException(descriptorName + outputShapeError);
681  }
682  }
683 
684  for (auto i = unsignedAxis + 1; i < inputNumDimensions; ++i)
685  {
686  if (outputShape[i - 1] != inputShape[i])
687  {
688  throw InvalidArgumentException(descriptorName + outputShapeError);
689  }
690  }
691  }
692 }

References armnn::BFloat16, armnn::Float16, armnn::Float32, TensorInfo::GetDataType(), TensorShape::GetNumDimensions(), TensorInfo::GetShape(), armnnUtils::GetUnsignedAxis(), ArgMinMaxDescriptor::m_Axis, WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< ArgMinMaxDescriptor >::m_Parameters, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::Signed32, and armnn::Signed64.


The documentation for this struct was generated from the following files:
armnnUtils::GetUnsignedAxis
unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis)
Definition: TensorUtils.cpp:236
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::DataType::Float32
@ Float32
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::DataType::QSymmS16
@ QSymmS16
armnn::DataType::BFloat16
@ BFloat16
armnn::DataType::Float16
@ Float16
armnn::WorkloadInfo::m_OutputTensorInfos
std::vector< TensorInfo > m_OutputTensorInfos
Definition: WorkloadInfo.hpp:19
armnn::QueueDescriptorWithParameters< ArgMinMaxDescriptor >::m_Parameters
ArgMinMaxDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::TensorShape::GetNumDimensions
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::TensorInfo::GetDataType
DataType GetDataType() const
Definition: Tensor.hpp:200
armnn::DataType::Signed32
@ Signed32
armnn::DataType::QAsymmS8
@ QAsymmS8
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::ArgMinMaxDescriptor::m_Axis
int m_Axis
Axis to reduce across the input tensor.
Definition: Descriptors.hpp:83
armnn::DataType::Signed64
@ Signed64