ArmNN
 25.11
Loading...
Searching...
No Matches
StackQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

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

Public Member Functions

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

Additional Inherited Members

Public Attributes inherited from QueueDescriptorWithParameters< StackDescriptor >
StackDescriptor m_Parameters
Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs
void * m_AdditionalInfoObject
bool m_AllowExpandedDims = false
Protected Member Functions inherited from QueueDescriptorWithParameters< StackDescriptor >
 QueueDescriptorWithParameters ()=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 152 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo & workloadInfo) const

Definition at line 916 of file WorkloadData.cpp.

917{
918 const std::string descriptorName{"StackQueueDescriptor"};
919
920 ValidateNumOutputs(workloadInfo, descriptorName, 1);
921
922 if (m_Parameters.m_NumInputs != workloadInfo.m_InputTensorInfos.size())
923 {
924 throw InvalidArgumentException(descriptorName + ": Must have the defined number of input tensors.");
925 }
926
927 // All inputs must have the same shape, which is defined in parameters
928 const TensorShape& inputShape = m_Parameters.m_InputShape;
929 for (unsigned int i = 0; i < workloadInfo.m_InputTensorInfos.size(); ++i)
930 {
931 if (workloadInfo.m_InputTensorInfos[i].GetShape() != inputShape)
932 {
933 throw InvalidArgumentException(descriptorName + ": All input tensor shapes must match the defined shape.");
934 }
935 }
936
937 if (inputShape.GetNumDimensions() > 4)
938 {
939 throw InvalidArgumentException(descriptorName + ": Input tensor may have up to 4 dimensions.");
940 }
941
942 // m_Axis is 0-based and may take values from 0 to the number of input dimensions (inclusive),
943 // since the output tensor has an additional dimension.
944 if (m_Parameters.m_Axis > inputShape.GetNumDimensions())
945 {
946 throw InvalidArgumentException(descriptorName + ": Axis may not be greater "
947 "than the number of input dimensions.");
948 }
949
950 // Output shape must be as inferred from the input shape
951 const TensorShape& outputShape = workloadInfo.m_OutputTensorInfos[0].GetShape();
952 for (unsigned int i = 0; i < m_Parameters.m_Axis; ++i)
953 {
954 if (outputShape[i] != inputShape[i])
955 {
956 throw InvalidArgumentException(descriptorName + ": Output tensor must "
957 "match shape inferred from input tensor.");
958 }
959 }
960
961 if (outputShape[m_Parameters.m_Axis] != m_Parameters.m_NumInputs)
962 {
963 throw InvalidArgumentException(descriptorName + ": Output tensor must "
964 "match shape inferred from input tensor.");
965 }
966
967 for (unsigned int i = m_Parameters.m_Axis + 1; i < inputShape.GetNumDimensions() + 1; ++i)
968 {
969 if (outputShape[i] != inputShape[i-1])
970 {
971 throw InvalidArgumentException(descriptorName + ": Output tensor must "
972 "match shape inferred from input tensor.");
973 }
974 }
975
976 if (outputShape.GetNumDimensions() > 5)
977 {
978 throw InvalidArgumentException(descriptorName + ": Output tensor may have up to 5 dimensions.");
979 }
980
981 // Check the supported data types
982 std::vector<DataType> supportedTypes =
983 {
993 };
994
995 ValidateDataTypes(workloadInfo.m_InputTensorInfos[0], supportedTypes, descriptorName);
996
997 for (unsigned int i = 1ul; i < workloadInfo.m_InputTensorInfos.size(); ++i)
998 {
999 ValidateTensorDataTypesMatch(workloadInfo.m_InputTensorInfos[0],
1000 workloadInfo.m_InputTensorInfos[i],
1001 descriptorName,
1002 "input_0",
1003 "input_" + std::to_string(i));
1004 }
1005
1006 ValidateTensorDataTypesMatch(workloadInfo.m_InputTensorInfos[0],
1007 workloadInfo.m_OutputTensorInfos[0],
1008 descriptorName,
1009 "input_0",
1010 "output");
1011}
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition Tensor.cpp:174
TensorShape m_InputShape
Required shape of all input tensors.
uint32_t m_Axis
0-based axis along which to stack the input tensors.
uint32_t m_NumInputs
Number of input tensors.
std::vector< TensorInfo > m_OutputTensorInfos
std::vector< TensorInfo > m_InputTensorInfos

References armnn::BFloat16, armnn::Boolean, armnn::Float16, armnn::Float32, TensorShape::GetNumDimensions(), WorkloadInfo::m_InputTensorInfos, WorkloadInfo::m_OutputTensorInfos, QueueDescriptorWithParameters< StackDescriptor >::m_Parameters, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::Signed32, and armnn::Signed64.


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