Compute Library
 21.02
WindowIterator< L > Class Template Reference

Iterate over a portion of a Window. More...

#include <WindowIterator.h>

Public Member Functions

 WindowIterator (const Window &w, const Coordinates &start, const Coordinates &end, L &&lambda_function)
 Construct a WindowIterator object. More...
 
template<typename M >
void iterate_3D (M &&on_new_row_size)
 Iterate over the lowest 3 dimensions of the window. More...
 
template<typename M >
void iterate_2D (M &&on_new_row_size)
 Iterate over the lowest 2 dimensions of the window. More...
 
void set_step (size_t dim, int step)
 Change the step used for the iteration. More...
 
const Coordinatesend_position () const
 Returns the coordinates in absolute coordinates of the end position. More...
 

Detailed Description

template<typename L>
class arm_compute::WindowIterator< L >

Iterate over a portion of a Window.

Definition at line 147 of file WindowIterator.h.

Constructor & Destructor Documentation

◆ WindowIterator()

WindowIterator ( const Window w,
const Coordinates start,
const Coordinates end,
L &&  lambda_function 
)
inline

Construct a WindowIterator object.

Parameters
[in]wWindow to use for the iteration
[in]startWhere to start iterating from (In Window coordinates)
[in]endWhere to stop iterating (In Window coordinates).
[in]lambda_functionLambda function to call for every iteration between start and end. (It will be called last for end - 1)

Definition at line 157 of file WindowIterator.h.

158  : _lambda_function(std::move(lambda_function)),
161  _w(w)
162  {
163  }
SimpleTensor< float > w
Definition: DFT.cpp:156
Coordinates convert_window_coord_to_position(const Window &w, const Coordinates &offset)
Convert an offset in window steps into absolute coordinates.
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

Member Function Documentation

◆ end_position()

const Coordinates& end_position ( ) const
inline

Returns the coordinates in absolute coordinates of the end position.

Returns
End position coordinates.

Definition at line 210 of file WindowIterator.h.

211  {
212  return _end;
213  }

◆ iterate_2D()

void iterate_2D ( M &&  on_new_row_size)
inline

Iterate over the lowest 2 dimensions of the window.

Parameters
[in]on_new_row_sizeCallback to be called before lambda_function every time the width of the row processed changes.

Definition at line 189 of file WindowIterator.h.

190  {
191  iterate_2D_internal(on_new_row_size, _end.x(), _end.y());
192  }
T x() const
Alias to access the size of the first dimension.
Definition: Dimensions.h:87
T y() const
Alias to access the size of the second dimension.
Definition: Dimensions.h:92

◆ iterate_3D()

void iterate_3D ( M &&  on_new_row_size)
inline

Iterate over the lowest 3 dimensions of the window.

Parameters
[in]on_new_row_sizeCallback to be called before lambda_function every time the width of the row processed changes.

Definition at line 169 of file WindowIterator.h.

170  {
171  while(_end.z() != _position.z())
172  {
173  ARM_COMPUTE_PRINTF("New slice %d\n", _position.z());
174  iterate_2D_internal(on_new_row_size, _w.x().end() - _w.x().step(), _w.y().end() - _w.y().step());
175  _position[2] += _w.z().step();
176  _position[1] = _w.y().start();
177  _position[0] = _w.x().start();
178  }
179  // Left over:
180  ARM_COMPUTE_PRINTF("Left over slice\n");
181  iterate_2D(on_new_row_size);
182  }
constexpr int step() const
Return the step of the dimension.
Definition: Window.h:104
constexpr const Dimension & z() const
Alias to access the third dimension of the window.
Definition: Window.h:163
T z() const
Alias to access the size of the third dimension.
Definition: Dimensions.h:97
void iterate_2D(M &&on_new_row_size)
Iterate over the lowest 2 dimensions of the window.
#define ARM_COMPUTE_PRINTF(...)
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
Definition: Window.h:154
constexpr int end() const
Return the end of the dimension.
Definition: Window.h:99
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:94
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
Definition: Window.h:145

◆ set_step()

void set_step ( size_t  dim,
int  step 
)
inline

Change the step used for the iteration.

Note
Does not affect the start and end points.
Parameters
[in]dimDimension to change
[in]stepNew step to use for the given dimension.

Definition at line 201 of file WindowIterator.h.

202  {
203  _w.set_dimension_step(dim, step);
204  }
void set_dimension_step(size_t dimension, int step)
Set the step of a given dimension.
Definition: Window.inl:167
constexpr int step
Definition: fp32.cpp:35

The documentation for this class was generated from the following file: