ArmNN
 22.05
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 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< SliceDescriptor >
SliceDescriptor 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< 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 696 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3632 of file WorkloadData.cpp.

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

3633 {
3634  const std::string descriptorName{"SliceQueueDescriptor"};
3635 
3636  ValidateNumInputs(workloadInfo, descriptorName, 1);
3637  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3638 
3639  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3640  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3641 
3642  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3643 
3644  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3645  if (rank > 4)
3646  {
3647  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3648  }
3649 
3650  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3651 
3652  // Check if m_Begin and m_Size have the expected length
3653  if (m_Parameters.m_Begin.size() != rank)
3654  {
3655  throw InvalidArgumentException(descriptorName +
3656  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3657  }
3658  if (m_Parameters.m_Size.size() != rank)
3659  {
3660  throw InvalidArgumentException(descriptorName +
3661  ": Length of size descriptor must equal rank " + std::to_string(rank));
3662  }
3663 
3664  // Check if the shape of the output tensor matches m_Size
3665  const TensorShape& outputShape = outputTensorInfo.GetShape();
3666  for (unsigned int i = 0u; i < rank; ++i)
3667  {
3668  if (m_Parameters.m_Size[i] != outputShape[i])
3669  {
3670  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3671  }
3672  }
3673 
3674  // Check if the sum of begin offset and size in a given dimension
3675  // does not exceed the size of corresponding input
3676  const TensorShape& inputShape = inputTensorInfo.GetShape();
3677  for(unsigned int i = 0u; i < rank; ++i)
3678  {
3679  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3680  {
3681  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3682  std::to_string(i) + " exceeds input size.");
3683  }
3684  }
3685 }
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
void ValidateTensorNumDimensions(const TensorInfo &tensor, std::string const &descName, unsigned int numDimensions, std::string const &tensorName) const
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:195

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