ArmNN
 20.05
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
 

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
 
- 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 ()=default
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 135 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 616 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, and armnn::Signed32.

617 {
618  const std::string descriptorName{"ArgMinMaxQueueDescriptor"};
619 
620  ValidateNumInputs(workloadInfo, descriptorName, 1);
621  ValidateNumOutputs(workloadInfo, descriptorName, 1);
622 
623  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
624  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
625 
626  if (outputTensorInfo.GetDataType() != DataType::Signed32)
627  {
628  throw InvalidArgumentException(descriptorName + ": Output of ArgMinMax layer must be Int32.");
629  }
630 
631  std::vector<DataType> supportedInputTypes =
632  {
640  };
641 
642  ValidateDataTypes(inputTensorInfo, supportedInputTypes, descriptorName);
643 
644  auto inputShape = inputTensorInfo.GetShape();
645  auto outputShape = outputTensorInfo.GetShape();
646 
647  auto inputNumDimensions = inputShape.GetNumDimensions();
648  auto unsignedAxis = armnnUtils::GetUnsignedAxis(inputNumDimensions, m_Parameters.m_Axis);
649 
650  const std::string outputShapeError{": Output tensor shape does not match shape inferred from input tensor."};
651 
652  // 1D input shape results in scalar output shape
653  if (inputShape.GetNumDimensions() == 1)
654  {
655  if (outputShape.GetNumDimensions() != 1 && outputShape[0] != 1)
656  {
657  throw InvalidArgumentException(descriptorName + outputShapeError);
658  }
659  }
660  else
661  {
662  for (unsigned int i = 0; i < unsignedAxis; ++i)
663  {
664  if (outputShape[i] != inputShape[i])
665  {
666  throw InvalidArgumentException(descriptorName + outputShapeError);
667  }
668  }
669 
670  for (auto i = unsignedAxis + 1; i < inputNumDimensions; ++i)
671  {
672  if (outputShape[i - 1] != inputShape[i])
673  {
674  throw InvalidArgumentException(descriptorName + outputShapeError);
675  }
676  }
677  }
678 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
std::vector< TensorInfo > m_InputTensorInfos
DataType GetDataType() const
Definition: Tensor.hpp:95
unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis)
std::vector< TensorInfo > m_OutputTensorInfos
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:43
int m_Axis
Axis to reduce across the input tensor.
Definition: Descriptors.hpp:66

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