Compute Library
 23.08
ValidRegion Struct Reference

Container for valid region of a window. More...

#include <Types.h>

Collaboration diagram for ValidRegion:
[legend]

Public Member Functions

 ValidRegion ()
 Default constructor. More...
 
 ValidRegion (const ValidRegion &)=default
 Allow instances of this class to be copy constructed. More...
 
 ValidRegion (ValidRegion &&)=default
 Allow instances of this class to be move constructed. More...
 
ValidRegionoperator= (const ValidRegion &)=default
 Allow instances of this class to be copied. More...
 
ValidRegionoperator= (ValidRegion &&)=default
 Allow instances of this class to be moved. More...
 
 ~ValidRegion ()=default
 Default destructor. More...
 
 ValidRegion (const Coordinates &an_anchor, const TensorShape &a_shape)
 Constructor for a valid region with default number of dimensions. More...
 
 ValidRegion (const Coordinates &an_anchor, const TensorShape &a_shape, size_t num_dimensions)
 Constructor for a valid region with specified number of dimensions. More...
 
int start (unsigned int d) const
 Return the start of the valid region for the given dimension d. More...
 
int end (unsigned int d) const
 Return the end of the valid region for the given dimension d. More...
 
ValidRegionset (size_t dimension, int start, size_t size)
 Accessor to set the value of anchor and shape for one of the dimensions. More...
 

Data Fields

Coordinates anchor
 Anchor for the start of the valid region. More...
 
TensorShape shape
 Shape of the valid region. More...
 

Friends

bool operator== (const ValidRegion &lhs, const ValidRegion &rhs)
 Check whether two valid regions are equal. More...
 

Detailed Description

Container for valid region of a window.

Definition at line 144 of file Types.h.

Constructor & Destructor Documentation

◆ ValidRegion() [1/5]

ValidRegion ( )
inline

Default constructor.

Definition at line 147 of file Types.h.

148  : anchor{}, shape{}
149  {
150  }

◆ ValidRegion() [2/5]

ValidRegion ( const ValidRegion )
default

Allow instances of this class to be copy constructed.

◆ ValidRegion() [3/5]

ValidRegion ( ValidRegion &&  )
default

Allow instances of this class to be move constructed.

◆ ~ValidRegion()

~ValidRegion ( )
default

Default destructor.

◆ ValidRegion() [4/5]

ValidRegion ( const Coordinates an_anchor,
const TensorShape a_shape 
)
inline

Constructor for a valid region with default number of dimensions.

Parameters
[in]an_anchorAnchor for the start of the valid region.
[in]a_shapeShape of the valid region.

Definition at line 169 of file Types.h.

170  : anchor{ an_anchor }, shape{ a_shape }
171  {
173  }

◆ ValidRegion() [5/5]

ValidRegion ( const Coordinates an_anchor,
const TensorShape a_shape,
size_t  num_dimensions 
)
inline

Constructor for a valid region with specified number of dimensions.

Parameters
[in]an_anchorAnchor for the start of the valid region.
[in]a_shapeShape of the valid region.
[in]num_dimensionsNumber of dimensions (must be >= number of dimensions of anchor and shape).

Definition at line 182 of file Types.h.

183  : anchor{ an_anchor }, shape{ a_shape }
184  {
185  ARM_COMPUTE_ERROR_ON(num_dimensions < std::max(anchor.num_dimensions(), shape.num_dimensions()));
186  anchor.set_num_dimensions(num_dimensions);
187  }

Member Function Documentation

◆ end()

int end ( unsigned int  d) const
inline

Return the end of the valid region for the given dimension d.

Definition at line 196 of file Types.h.

197  {
198  return anchor[d] + shape[d];
199  }

References ValidRegion::anchor, and ValidRegion::shape.

Referenced by arm_compute::test::is_in_valid_region().

◆ operator=() [1/2]

ValidRegion& operator= ( const ValidRegion )
default

Allow instances of this class to be copied.

◆ operator=() [2/2]

ValidRegion& operator= ( ValidRegion &&  )
default

Allow instances of this class to be moved.

◆ set()

ValidRegion& set ( size_t  dimension,
int  start,
size_t  size 
)
inline

Accessor to set the value of anchor and shape for one of the dimensions.

Parameters
[in]dimensionDimension for which the value is set.
[in]startValue to be set in anchor for the dimension.
[in]sizeValue to be set in shape for the dimension.
Returns
*this.

Definition at line 209 of file Types.h.

210  {
211  anchor.set(dimension, start);
212  shape.set(dimension, size);
213  return *this;
214  }

References ValidRegion::anchor, Dimensions< T >::set(), TensorShape::set(), ValidRegion::shape, and ValidRegion::start().

◆ start()

int start ( unsigned int  d) const
inline

Return the start of the valid region for the given dimension d.

Definition at line 190 of file Types.h.

191  {
192  return anchor[d];
193  }

References ValidRegion::anchor.

Referenced by arm_compute::test::is_in_valid_region(), and ValidRegion::set().

Friends And Related Function Documentation

◆ operator==

bool operator== ( const ValidRegion lhs,
const ValidRegion rhs 
)
friend

Check whether two valid regions are equal.

Parameters
[in]lhsLHS valid region
[in]rhsRHS valid region
Returns
True if the valid regions are the same.

Definition at line 228 of file Types.h.

229 {
230  return (lhs.anchor == rhs.anchor) && (lhs.shape == rhs.shape);
231 }

Field Documentation

◆ anchor

◆ shape


The documentation for this struct was generated from the following file:
arm_compute::Dimensions::set
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: Dimensions.h:76
ARM_COMPUTE_ERROR_ON
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:467
arm_compute::ValidRegion::start
int start(unsigned int d) const
Return the start of the valid region for the given dimension d.
Definition: Types.h:190
arm_compute::ValidRegion::shape
TensorShape shape
Shape of the valid region.
Definition: Types.h:226
arm_compute::Dimensions::set_num_dimensions
void set_num_dimensions(size_t num_dimensions)
Set number of dimensions.
Definition: Dimensions.h:149
arm_compute::TensorShape::set
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:79
arm_compute::Dimensions::num_dimensions
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
Definition: Dimensions.h:143
arm_compute::ValidRegion::anchor
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:225