ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
onert::exec::feature::IndexIterator Class Reference

Class to iterate Callable with Index of feature. More...

#include <IndexIterator.h>

Public Member Functions

 IndexIterator (const ir::FeatureShape &shape)
 Construct IndexIterator object with Shape of feature.
 
template<typename Callable >
IndexIteratoriter (Callable cb)
 Call a function iterated.
 

Detailed Description

Class to iterate Callable with Index of feature.

Definition at line 33 of file IndexIterator.h.

Constructor & Destructor Documentation

◆ IndexIterator()

onert::exec::feature::IndexIterator::IndexIterator ( const ir::FeatureShape shape)
inline

Construct IndexIterator object with Shape of feature.

Parameters
[in]shapeShape reference of feature

Definition at line 40 of file IndexIterator.h.

40 : _shape{shape}
41 {
42 // DO NOTHING
43 }

Member Function Documentation

◆ iter()

template<typename Callable >
IndexIterator & onert::exec::feature::IndexIterator::iter ( Callable  cb)
inline

Call a function iterated.

Parameters
[in]cbA callback function
Returns
Current IndexIterator object

Definition at line 51 of file IndexIterator.h.

52 {
53 for (int32_t batch = 0; batch < _shape.N; ++batch)
54 {
55 for (int32_t ch = 0; ch < _shape.C; ++ch)
56 {
57 for (int32_t row = 0; row < _shape.H; ++row)
58 {
59 for (int32_t col = 0; col < _shape.W; ++col)
60 {
61 cb(batch, ch, row, col);
62 }
63 }
64 }
65 }
66
67 return (*this);
68 }

References onert::ir::FeatureShape::C, onert::ir::FeatureShape::H, onert::ir::FeatureShape::N, and onert::ir::FeatureShape::W.

Referenced by onert::exec::feature::operator<<().


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