ArmNN  NotReleased
SliceQueueDescriptor Struct Reference

#include <WorkloadData.hpp>

Inheritance diagram for SliceQueueDescriptor:
QueueDescriptorWithParameters< SliceDescriptor > 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< SliceDescriptor >
SliceDescriptor m_Parameters
 
- Public Attributes inherited from QueueDescriptor
std::vector< ITensorHandle * > m_Inputs
 
std::vector< ITensorHandle * > m_Outputs
 
- Protected Member Functions inherited from QueueDescriptorWithParameters< SliceDescriptor >
 ~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 549 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 2878 of file WorkloadData.cpp.

References TensorInfo::GetNumDimensions(), TensorInfo::GetShape(), WorkloadInfo::m_InputTensorInfos, and WorkloadInfo::m_OutputTensorInfos.

2879 {
2880  const std::string descriptorName{"SliceQueueDescriptor"};
2881 
2882  ValidateNumInputs(workloadInfo, descriptorName, 1);
2883  ValidateNumOutputs(workloadInfo, descriptorName, 1);
2884 
2885  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
2886  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
2887 
2888  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
2889 
2890  const unsigned int rank = inputTensorInfo.GetNumDimensions();
2891  if (rank > 4)
2892  {
2893  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
2894  }
2895 
2896  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
2897 
2898  // Check if m_Begin and m_Size have the expected length
2899  if (m_Parameters.m_Begin.size() != rank)
2900  {
2901  throw InvalidArgumentException(descriptorName +
2902  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
2903  }
2904  if (m_Parameters.m_Size.size() != rank)
2905  {
2906  throw InvalidArgumentException(descriptorName +
2907  ": Length of size descriptor must equal rank " + std::to_string(rank));
2908  }
2909 
2910  // Check if the shape of the output tensor matches m_Size
2911  const TensorShape& outputShape = outputTensorInfo.GetShape();
2912  for (unsigned int i = 0u; i < rank; ++i)
2913  {
2914  if (m_Parameters.m_Size[i] != outputShape[i])
2915  {
2916  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
2917  }
2918  }
2919 
2920  // Check if the sum of begin offset and size in a given dimension
2921  // does not exceed the size of corresponding input
2922  const TensorShape& inputShape = inputTensorInfo.GetShape();
2923  for(unsigned int i = 0u; i < rank; ++i)
2924  {
2925  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
2926  {
2927  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
2928  std::to_string(i) + " exceeds input size.");
2929  }
2930  }
2931 }
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:92
std::vector< TensorInfo > m_OutputTensorInfos
std::vector< unsigned int > m_Begin
Beginning indices of the slice in each dimension.
std::vector< TensorInfo > m_InputTensorInfos
std::vector< unsigned int > m_Size
Size of the slice in each dimension.
const TensorShape & GetShape() const
Definition: Tensor.hpp:88

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