ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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 37 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 44 of file IndexIterator.h.

44 : _shape{shape}
45 {
46 // DO NOTHING
47 }

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 55 of file IndexIterator.h.

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

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: