ArmNN
 24.02
ConcatQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

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

Classes

struct  ViewOrigin
 

Public Member Functions

void Validate (const WorkloadInfo &workloadInfo) const
 
- Public Member Functions inherited from QueueDescriptorWithParameters< OriginsDescriptor >
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
 

Public Attributes

std::vector< ViewOriginm_ViewOrigins
 
- Public Attributes inherited from QueueDescriptorWithParameters< OriginsDescriptor >
OriginsDescriptor m_Parameters
 
- Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
 
std::vector< ITensorHandle * > m_Outputs
 
void * m_AdditionalInfoObject
 
bool m_AllowExpandedDims = false
 

Additional Inherited Members

- Protected Member Functions inherited from QueueDescriptorWithParameters< OriginsDescriptor >
 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 130 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 818 of file WorkloadData.cpp.

819 {
820  const std::string descriptorName{"ConcatQueueDescriptor"};
821 
822  ValidateNumOutputs(workloadInfo, descriptorName, 1);
823 
824  if (m_Inputs.size() <= 0)
825  {
826  throw InvalidArgumentException(descriptorName + ": At least one input needs to be provided.");
827  }
828  if (m_Outputs.size() <= 0)
829  {
830  throw InvalidArgumentException(descriptorName + ": At least one output needs to be provided.");
831  }
832 
833  if (workloadInfo.m_InputTensorInfos.size() <= 0)
834  {
835  throw InvalidArgumentException(descriptorName + ": At least one TensorInfo input needs to be provided.");
836  }
837  if (workloadInfo.m_OutputTensorInfos.size() <= 0)
838  {
839  throw InvalidArgumentException(descriptorName + ": At least one TensorInfo output needs to be provided.");
840  }
841 
842  if(m_Parameters.GetConcatAxis() > workloadInfo.m_InputTensorInfos[0].GetShape().GetNumDimensions())
843  {
844  throw InvalidArgumentException(descriptorName + ": Invalid concatenation axis provided.");
845  }
846 
847  if (workloadInfo.m_InputTensorInfos[0].GetShape().GetNumDimensions() - m_Parameters.GetConcatAxis() == 1)
848  {
849  return;
850  }
851 
852  if (workloadInfo.m_InputTensorInfos.size() != m_ViewOrigins.size())
853  {
855  descriptorName + ": Number of split windows "
856  "has to match number of workloadInfo.m_InputTensorInfos. "
857  "Number of windows: " +
858  to_string(m_ViewOrigins.size()) +
859  ". Number of workloadInfo.m_InputTensorInfos: " + to_string(workloadInfo.m_InputTensorInfos.size()));
860  }
861 
862  //The dimensionality of all the windows has to match the dimensionality (not shape) of the output.
863  std::size_t outputDims = workloadInfo.m_OutputTensorInfos[0].GetNumDimensions();
864  for(unsigned int w = 0; w < m_ViewOrigins.size(); ++w )
865  {
866  //Checks that the dimensionality of output is same as the split windows.
867  ViewOrigin const& e = m_ViewOrigins[w];
868  if (e.m_Origin.size() != outputDims)
869  {
870  throw InvalidArgumentException(descriptorName + ": Window origin have to "
871  "have the same dimensionality as the output tensor. "
872  "Window origin (index: " +
873  to_string(w) + ") has " + to_string(e.m_Origin.size()) +
874  " dimensions, the output "
875  "tensor has " +
876  to_string(outputDims) + " dimensions.");
877  }
878  //Checks that the merge windows are within the output tensor.
879  for (unsigned int i = 0; i < e.m_Origin.size(); ++i)
880  {
881  if (e.m_Origin[i] + workloadInfo.m_InputTensorInfos[w].GetShape()[i]
882  > workloadInfo.m_OutputTensorInfos[0].GetShape()[i])
883  {
884  throw InvalidArgumentException(descriptorName + ": Window extent coordinates have to "
885  "be smaller or equal than the size of the output in that coord.");
886  }
887  }
888  }
889 
890  // Check the supported data types
891  std::vector<DataType> supportedTypes =
892  {
901  };
902 
903  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
904  for (unsigned long i = 0ul; i < workloadInfo.m_InputTensorInfos.size(); ++i)
905  {
906  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[i];
907  ValidateDataTypes(inputTensorInfo, supportedTypes, descriptorName);
908 
909  const std::string inputName = "input_" + std::to_string(i);
910  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, inputName, "output");
911  }
912 }

References armnn::BFloat16, armnn::Boolean, armnn::Float16, armnn::Float32, OriginsDescriptor::GetConcatAxis(), QueueDescriptor::m_Inputs, WorkloadInfo::m_InputTensorInfos, ConcatQueueDescriptor::ViewOrigin::m_Origin, QueueDescriptor::m_Outputs, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< OriginsDescriptor >::m_Parameters, ConcatQueueDescriptor::m_ViewOrigins, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, and armnn::Signed32.

Member Data Documentation

◆ m_ViewOrigins

std::vector<ViewOrigin> m_ViewOrigins

The documentation for this struct was generated from the following files:
armnn::OriginsDescriptor::GetConcatAxis
unsigned int GetConcatAxis() const
Get the concatenation axis value.
Definition: Descriptors.cpp:162
armnn::DataType::Boolean
@ Boolean
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< OriginsDescriptor >::m_Parameters
OriginsDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::DataType::Signed32
@ Signed32
armnn::DataType::QAsymmS8
@ QAsymmS8
armnn::WorkloadInfo::m_InputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos
Definition: WorkloadInfo.hpp:18
armnn::ConcatQueueDescriptor::m_ViewOrigins
std::vector< ViewOrigin > m_ViewOrigins
Definition: WorkloadData.hpp:143
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26