ArmNN
 22.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 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 688 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3585 of file WorkloadData.cpp.

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

3586 {
3587  const std::string descriptorName{"SliceQueueDescriptor"};
3588 
3589  ValidateNumInputs(workloadInfo, descriptorName, 1);
3590  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3591 
3592  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3593  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3594 
3595  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3596 
3597  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3598  if (rank > 4)
3599  {
3600  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3601  }
3602 
3603  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3604 
3605  // Check if m_Begin and m_Size have the expected length
3606  if (m_Parameters.m_Begin.size() != rank)
3607  {
3608  throw InvalidArgumentException(descriptorName +
3609  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3610  }
3611  if (m_Parameters.m_Size.size() != rank)
3612  {
3613  throw InvalidArgumentException(descriptorName +
3614  ": Length of size descriptor must equal rank " + std::to_string(rank));
3615  }
3616 
3617  // Check if the shape of the output tensor matches m_Size
3618  const TensorShape& outputShape = outputTensorInfo.GetShape();
3619  for (unsigned int i = 0u; i < rank; ++i)
3620  {
3621  if (m_Parameters.m_Size[i] != outputShape[i])
3622  {
3623  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3624  }
3625  }
3626 
3627  // Check if the sum of begin offset and size in a given dimension
3628  // does not exceed the size of corresponding input
3629  const TensorShape& inputShape = inputTensorInfo.GetShape();
3630  for(unsigned int i = 0u; i < rank; ++i)
3631  {
3632  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3633  {
3634  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3635  std::to_string(i) + " exceeds input size.");
3636  }
3637  }
3638 }
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: