ArmNN
 21.11
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
 
template<typename T >
const T * GetAdditionalInformation () 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
 
void * m_AdditionalInfoObject
 
- 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 ()
 
 QueueDescriptor (QueueDescriptor const &)=default
 
QueueDescriptoroperator= (QueueDescriptor const &)=default
 

Detailed Description

Definition at line 674 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3527 of file WorkloadData.cpp.

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

3528 {
3529  const std::string descriptorName{"SliceQueueDescriptor"};
3530 
3531  ValidateNumInputs(workloadInfo, descriptorName, 1);
3532  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3533 
3534  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3535  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3536 
3537  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3538 
3539  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3540  if (rank > 4)
3541  {
3542  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3543  }
3544 
3545  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3546 
3547  // Check if m_Begin and m_Size have the expected length
3548  if (m_Parameters.m_Begin.size() != rank)
3549  {
3550  throw InvalidArgumentException(descriptorName +
3551  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3552  }
3553  if (m_Parameters.m_Size.size() != rank)
3554  {
3555  throw InvalidArgumentException(descriptorName +
3556  ": Length of size descriptor must equal rank " + std::to_string(rank));
3557  }
3558 
3559  // Check if the shape of the output tensor matches m_Size
3560  const TensorShape& outputShape = outputTensorInfo.GetShape();
3561  for (unsigned int i = 0u; i < rank; ++i)
3562  {
3563  if (m_Parameters.m_Size[i] != outputShape[i])
3564  {
3565  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3566  }
3567  }
3568 
3569  // Check if the sum of begin offset and size in a given dimension
3570  // does not exceed the size of corresponding input
3571  const TensorShape& inputShape = inputTensorInfo.GetShape();
3572  for(unsigned int i = 0u; i < rank; ++i)
3573  {
3574  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3575  {
3576  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3577  std::to_string(i) + " exceeds input size.");
3578  }
3579  }
3580 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:191
std::vector< unsigned int > m_Size
Size of the slice in each dimension.
std::vector< TensorInfo > m_InputTensorInfos
std::vector< unsigned int > m_Begin
Beginning indices of the slice in each dimension.
std::vector< TensorInfo > m_OutputTensorInfos
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:195

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