ArmNN
 21.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 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 646 of file WorkloadData.hpp.

Member Function Documentation

◆ Validate()

void Validate ( const WorkloadInfo workloadInfo) const

Definition at line 3400 of file WorkloadData.cpp.

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

3401 {
3402  const std::string descriptorName{"SliceQueueDescriptor"};
3403 
3404  ValidateNumInputs(workloadInfo, descriptorName, 1);
3405  ValidateNumOutputs(workloadInfo, descriptorName, 1);
3406 
3407  const TensorInfo& inputTensorInfo = workloadInfo.m_InputTensorInfos[0];
3408  const TensorInfo& outputTensorInfo = workloadInfo.m_OutputTensorInfos[0];
3409 
3410  ValidateTensorDataTypesMatch(inputTensorInfo, outputTensorInfo, descriptorName, "input", "output");
3411 
3412  const unsigned int rank = inputTensorInfo.GetNumDimensions();
3413  if (rank > 4)
3414  {
3415  throw InvalidArgumentException(descriptorName + ": Input tensors with rank greater than 4 are not supported.");
3416  }
3417 
3418  ValidateTensorNumDimensions(outputTensorInfo, descriptorName, rank, "output");
3419 
3420  // Check if m_Begin and m_Size have the expected length
3421  if (m_Parameters.m_Begin.size() != rank)
3422  {
3423  throw InvalidArgumentException(descriptorName +
3424  ": Length of begin offset descriptor must equal rank " + std::to_string(rank));
3425  }
3426  if (m_Parameters.m_Size.size() != rank)
3427  {
3428  throw InvalidArgumentException(descriptorName +
3429  ": Length of size descriptor must equal rank " + std::to_string(rank));
3430  }
3431 
3432  // Check if the shape of the output tensor matches m_Size
3433  const TensorShape& outputShape = outputTensorInfo.GetShape();
3434  for (unsigned int i = 0u; i < rank; ++i)
3435  {
3436  if (m_Parameters.m_Size[i] != outputShape[i])
3437  {
3438  throw InvalidArgumentException(descriptorName + ": Size descriptor does not match output tensor.");
3439  }
3440  }
3441 
3442  // Check if the sum of begin offset and size in a given dimension
3443  // does not exceed the size of corresponding input
3444  const TensorShape& inputShape = inputTensorInfo.GetShape();
3445  for(unsigned int i = 0u; i < rank; ++i)
3446  {
3447  if (m_Parameters.m_Begin[i] + m_Parameters.m_Size[i] > inputShape[i])
3448  {
3449  throw InvalidArgumentException(descriptorName + ": Sum of begin offset and size for dimension " +
3450  std::to_string(i) + " exceeds input size.");
3451  }
3452  }
3453 }
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
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:191

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