ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir::ShapeIter Class Reference

#include <ShapeRange.h>

Collaboration diagram for mir::ShapeIter:

Public Member Functions

ShapeIteroperator++ ()
 
const ShapeIter operator++ (int)
 
const Indexoperator* () const
 
bool operator!= (const ShapeIter &iter) const
 

Friends

class ShapeRange
 

Detailed Description

Definition at line 28 of file ShapeRange.h.

Member Function Documentation

◆ operator!=()

bool mir::ShapeIter::operator!= ( const ShapeIter iter) const
inline

Definition at line 60 of file ShapeRange.h.

61 {
62 assert(iter._index.rank() == _index.rank());
63 assert(iter._shape == _shape);
64 return _pos != iter._pos;
65 }
int32_t rank() const
Definition Index.h:43

References mir::Index::rank().

◆ operator*()

const Index & mir::ShapeIter::operator* ( ) const
inline

Definition at line 58 of file ShapeRange.h.

58{ return _index; }

◆ operator++() [1/2]

ShapeIter & mir::ShapeIter::operator++ ( )
inline

Definition at line 32 of file ShapeRange.h.

33 {
34 if (_shape.rank() > 0)
35 {
36 auto *pidx = &_index.at(0);
37 auto *pshape = &_shape.dim(0);
38 int32_t rank = _shape.rank();
39 int32_t c = rank - 1;
40 pidx[c]++;
41 while (pidx[c] >= pshape[c] && c > 0)
42 {
43 pidx[c] = 0;
44 pidx[--c]++;
45 }
46 }
47 _pos++;
48 return *this;
49 }
int32_t & at(int32_t axis)
return position on given axis
Definition Index.h:64
int32_t & dim(int32_t axis) noexcept
Definition Shape.h:47
int32_t rank() const
Definition Shape.h:43

References mir::Index::at(), mir::Shape::dim(), and mir::Shape::rank().

◆ operator++() [2/2]

const ShapeIter mir::ShapeIter::operator++ ( int  )
inline

Definition at line 51 of file ShapeRange.h.

52 {
53 ShapeIter it = *this;
54 ++*this;
55 return it;
56 }

Friends And Related Symbol Documentation

◆ ShapeRange

friend class ShapeRange
friend

Definition at line 78 of file ShapeRange.h.


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