ArmNN
 22.02
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 QueueDescriptorWithParameters< SliceDescriptor >
virtual ~QueueDescriptorWithParameters ()=default
 
- Public Member Functions inherited from QueueDescriptor
virtual ~QueueDescriptor ()=default
 
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 (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 679 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3555 of file WorkloadData.cpp.

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

3556 {
3557  const std::string descriptorName{"SliceQueueDescriptor"};
3558 
3559  ValidateNumInputs(workloadInfo, descriptorName, 1);
3560  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3561 
3562  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3563  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3564 
3565  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3566 
3567  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3568  if (rank > 4)
3569  {
3570  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3571  }
3572 
3573  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3574 
3575  // Check if m_Begin and m_Size have the expected length
3576  if (m_Parameters.m_Begin.size() != rank)
3577  {
3578  throw InvalidArgumentException(descriptorName +
3579  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3580  }
3581  if (m_Parameters.m_Size.size() != rank)
3582  {
3583  throw InvalidArgumentException(descriptorName +
3584  ": Length of size descriptor must equal rank " + std::to_string(rank));
3585  }
3586 
3587  // Check if the shape of the output tensor matches m_Size
3588  const TensorShape& outputShape = outputTensorInfo.GetShape();
3589  for (unsigned int i = 0u; i < rank; ++i)
3590  {
3591  if (m_Parameters.m_Size[i] != outputShape[i])
3592  {
3593  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3594  }
3595  }
3596 
3597  // Check if the sum of begin offset and size in a given dimension
3598  // does not exceed the size of corresponding input
3599  const TensorShape& inputShape = inputTensorInfo.GetShape();
3600  for(unsigned int i = 0u; i < rank; ++i)
3601  {
3602  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3603  {
3604  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3605  std::to_string(i) + " exceeds input size.");
3606  }
3607  }
3608 }
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: