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

#include <ShapeRange.h>

Public Member Functions

 ShapeRange (const Shape &shape)
 
 ShapeRange (Shape &&shape)
 
ShapeIter begin ()
 
ShapeIter end ()
 
bool contains (const Index &idx)
 

Detailed Description

Definition at line 81 of file ShapeRange.h.

Constructor & Destructor Documentation

◆ ShapeRange() [1/2]

mir::ShapeRange::ShapeRange ( const Shape shape)
inlineexplicit

Definition at line 84 of file ShapeRange.h.

84: _shape(shape) {}

◆ ShapeRange() [2/2]

mir::ShapeRange::ShapeRange ( Shape &&  shape)
inlineexplicit

Definition at line 86 of file ShapeRange.h.

86: _shape(std::move(shape)) {}

Member Function Documentation

◆ begin()

ShapeIter mir::ShapeRange::begin ( )
inline

Definition at line 88 of file ShapeRange.h.

88{ return ShapeIter(_shape, 0); }

Referenced by mir_interpreter::Reshape().

◆ contains()

bool mir::ShapeRange::contains ( const Index idx)
inline

Definition at line 92 of file ShapeRange.h.

93 {
94 assert(idx.rank() == _shape.rank());
95 for (int32_t d = 0; d < idx.rank(); ++d)
96 {
97 if ((idx.at(d) >= _shape.dim(d)) || (idx.at(d) < 0))
98 return false;
99 }
100 return true;
101 }
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(), mir::Index::rank(), and mir::Shape::rank().

Referenced by mir_interpreter::AvgPool2DImpl< uint8_t >::run(), mir_interpreter::AvgPool2DImpl< T >::run(), mir_interpreter::DepthwiseConv2DImpl< T >::run(), mir_interpreter::MaxPool2DImpl< uint8_t >::run(), and mir_interpreter::MaxPool2DImpl< T >::run().

◆ end()

ShapeIter mir::ShapeRange::end ( )
inline

Definition at line 90 of file ShapeRange.h.

90{ return ShapeIter(_shape, _shape.numElements()); }
int32_t numElements() const
Definition Shape.cpp:30

References mir::Shape::numElements().


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