ArmNN  NotReleased
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 614 of file WorkloadData.cpp.

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

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

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