ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc::tensor::IndexIterator Class Reference

Class to iterate indexes available for given shape. More...

#include <IndexIterator.h>

Public Member Functions

 IndexIterator (const Shape &shape)
 Construct a new IndexIterator object.
 
 IndexIterator (IndexIterator &&)=default
 Construct a new IndexIterator object using reference.
 
 IndexIterator (const IndexIterator &)=delete
 Prevent copy constructor.
 
template<typename Callable >
IndexIteratoriter (Callable fn)
 Iterate all available indexes and run a function for each index.
 

Detailed Description

Class to iterate indexes available for given shape.

Definition at line 40 of file IndexIterator.h.

Constructor & Destructor Documentation

◆ IndexIterator() [1/3]

nnfw::misc::tensor::IndexIterator::IndexIterator ( const Shape shape)
inline

Construct a new IndexIterator object.

Parameters
[in]shapeShape of tensor of which index will be iterated

Definition at line 47 of file IndexIterator.h.

47 : _shape(shape)
48 {
49 // DO NOTHING
50 }

◆ IndexIterator() [2/3]

nnfw::misc::tensor::IndexIterator::IndexIterator ( IndexIterator &&  )
default

Construct a new IndexIterator object using reference.

Parameters
[in]IndexIteratorIndexIterator object to move

◆ IndexIterator() [3/3]

nnfw::misc::tensor::IndexIterator::IndexIterator ( const IndexIterator )
delete

Prevent copy constructor.

Member Function Documentation

◆ iter()

template<typename Callable >
IndexIterator & nnfw::misc::tensor::IndexIterator::iter ( Callable  fn)
inline

Iterate all available indexes and run a function for each index.

Parameters
[in]fnFunction that requires an index as a parameter.
Returns
IndexIterator object

Definition at line 70 of file IndexIterator.h.

71 {
72 for (IndexEnumerator e{_shape}; e.valid(); e.advance())
73 {
74 fn(e.curr());
75 }
76
77 return (*this);
78 }

Referenced by nnfw::misc::tensor::operator<<().


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