ArmNN
 21.08
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 635 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.

636 {
637  const std::string descriptorName{"ArgMinMaxQueueDescriptor"};
638 
639  ValidateNumInputs(workloadInfo, descriptorName, 1);
640  ValidateNumOutputs(workloadInfo, descriptorName, 1);
641 
642  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
643  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
644 
645  if (outputTensorInfo.GetDataType() != DataType::Signed32 &&
646  outputTensorInfo.GetDataType() != DataType::Signed64)
647  {
648  throw InvalidArgumentException(descriptorName + ": Output of ArgMinMax layer must be Int32 or Int64.");
649  }
650 
651  std::vector<DataType> supportedInputTypes =
652  {
661  };
662 
663  ValidateDataTypes(inputTensorInfo, supportedInputTypes, descriptorName);
664 
665  auto inputShape = inputTensorInfo.GetShape();
666  auto outputShape = outputTensorInfo.GetShape();
667 
668  auto inputNumDimensions = inputShape.GetNumDimensions();
669  auto unsignedAxis = armnnUtils::GetUnsignedAxis(inputNumDimensions, m_Parameters.m_Axis);
670 
671  const std::string outputShapeError{": Output tensor shape does not match shape inferred from input tensor."};
672 
673  // 1D input shape results in scalar output shape
674  if (inputShape.GetNumDimensions() == 1)
675  {
676  if (outputShape.GetNumDimensions() != 1 && outputShape[0] != 1)
677  {
678  throw InvalidArgumentException(descriptorName + outputShapeError);
679  }
680  }
681  else
682  {
683  for (unsigned int i = 0; i < unsignedAxis; ++i)
684  {
685  if (outputShape[i] != inputShape[i])
686  {
687  throw InvalidArgumentException(descriptorName + outputShapeError);
688  }
689  }
690 
691  for (auto i = unsignedAxis + 1; i < inputNumDimensions; ++i)
692  {
693  if (outputShape[i - 1] != inputShape[i])
694  {
695  throw InvalidArgumentException(descriptorName + outputShapeError);
696  }
697  }
698  }
699 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
std::vector< TensorInfo > m_InputTensorInfos
DataType GetDataType() const
Definition: Tensor.hpp:198
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:72

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