ArmNN
 21.08
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 663 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3458 of file WorkloadData.cpp.

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

3459 {
3460  const std::string descriptorName{"SliceQueueDescriptor"};
3461 
3462  ValidateNumInputs(workloadInfo, descriptorName, 1);
3463  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3464 
3465  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3466  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3467 
3468  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3469 
3470  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3471  if (rank > 4)
3472  {
3473  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3474  }
3475 
3476  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3477 
3478  // Check if m_Begin and m_Size have the expected length
3479  if (m_Parameters.m_Begin.size() != rank)
3480  {
3481  throw InvalidArgumentException(descriptorName +
3482  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3483  }
3484  if (m_Parameters.m_Size.size() != rank)
3485  {
3486  throw InvalidArgumentException(descriptorName +
3487  ": Length of size descriptor must equal rank " + std::to_string(rank));
3488  }
3489 
3490  // Check if the shape of the output tensor matches m_Size
3491  const TensorShape& outputShape = outputTensorInfo.GetShape();
3492  for (unsigned int i = 0u; i < rank; ++i)
3493  {
3494  if (m_Parameters.m_Size[i] != outputShape[i])
3495  {
3496  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3497  }
3498  }
3499 
3500  // Check if the sum of begin offset and size in a given dimension
3501  // does not exceed the size of corresponding input
3502  const TensorShape& inputShape = inputTensorInfo.GetShape();
3503  for(unsigned int i = 0u; i < rank; ++i)
3504  {
3505  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3506  {
3507  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3508  std::to_string(i) + " exceeds input size.");
3509  }
3510  }
3511 }
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: