ArmNN
 20.11
ArgMinMaxQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for ArgMinMaxQueueDescriptor:
QueueDescriptorWithParameters< ArgMinMaxDescriptor > QueueDescriptor

Public Member Functions

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
 

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
 
- Protected Member Functions inherited from QueueDescriptorWithParameters< ArgMinMaxDescriptor >
 ~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 153 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 643 of file WorkloadData.cpp.

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

644 {
645  const std::string descriptorName{"ArgMinMaxQueueDescriptor"};
646 
647  ValidateNumInputs(workloadInfo, descriptorName, 1);
648  ValidateNumOutputs(workloadInfo, descriptorName, 1);
649 
650  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
651  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
652 
653  if (outputTensorInfo.GetDataType() != DataType::Signed32 &&
654  outputTensorInfo.GetDataType() != DataType::Signed64)
655  {
656  throw InvalidArgumentException(descriptorName + ": Output of ArgMinMax layer must be Int32 or Int64.");
657  }
658 
659  std::vector<DataType> supportedInputTypes =
660  {
669  };
670 
671  ValidateDataTypes(inputTensorInfo, supportedInputTypes, descriptorName);
672 
673  auto inputShape = inputTensorInfo.GetShape();
674  auto outputShape = outputTensorInfo.GetShape();
675 
676  auto inputNumDimensions = inputShape.GetNumDimensions();
677  auto unsignedAxis = armnnUtils::GetUnsignedAxis(inputNumDimensions, m_Parameters.m_Axis);
678 
679  const std::string outputShapeError{": Output tensor shape does not match shape inferred from input tensor."};
680 
681  // 1D input shape results in scalar output shape
682  if (inputShape.GetNumDimensions() == 1)
683  {
684  if (outputShape.GetNumDimensions() != 1 && outputShape[0] != 1)
685  {
686  throw InvalidArgumentException(descriptorName + outputShapeError);
687  }
688  }
689  else
690  {
691  for (unsigned int i = 0; i < unsignedAxis; ++i)
692  {
693  if (outputShape[i] != inputShape[i])
694  {
695  throw InvalidArgumentException(descriptorName + outputShapeError);
696  }
697  }
698 
699  for (auto i = unsignedAxis + 1; i < inputNumDimensions; ++i)
700  {
701  if (outputShape[i - 1] != inputShape[i])
702  {
703  throw InvalidArgumentException(descriptorName + outputShapeError);
704  }
705  }
706  }
707 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
std::vector< TensorInfo > m_InputTensorInfos
DataType GetDataType() const
Definition: Tensor.hpp:194
unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis)
std::vector< TensorInfo > m_OutputTensorInfos
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174
int m_Axis
Axis to reduce across the input tensor.
Definition: Descriptors.hpp:67

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