ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::TensorSliceEnumerator Class Reference

#include <TensorSliceEnumerator.h>

Public Member Functions

 TensorSliceEnumerator ()=default
 
void shape (loco::TensorShape &s)
 
void begin (u32v_t &b)
 
void end (u32v_t &e)
 
void start (void)
 
bool valid (void)
 
void advance (void)
 
uint32_t cursor (uint32_t rank) const
 
const u32v_t cursor (void) const
 

Detailed Description

Definition at line 29 of file TensorSliceEnumerator.h.

Constructor & Destructor Documentation

◆ TensorSliceEnumerator()

moco::TensorSliceEnumerator::TensorSliceEnumerator ( )
default

Member Function Documentation

◆ advance()

void moco::TensorSliceEnumerator::advance ( void  )

Definition at line 72 of file TensorSliceEnumerator.cpp.

73{
74 uint32_t r = _rank_in - 1;
75 increment(r);
76}

◆ begin()

void moco::TensorSliceEnumerator::begin ( u32v_t b)
inline

Definition at line 36 of file TensorSliceEnumerator.h.

36{ _begin = b; }

◆ cursor() [1/2]

uint32_t moco::TensorSliceEnumerator::cursor ( uint32_t  rank) const

Definition at line 78 of file TensorSliceEnumerator.cpp.

79{
80 assert(rank < _rank_in);
81 return _cursor.at(rank);
82}

◆ cursor() [2/2]

const u32v_t moco::TensorSliceEnumerator::cursor ( void  ) const
inline

Definition at line 45 of file TensorSliceEnumerator.h.

45{ return _cursor; }

◆ end()

void moco::TensorSliceEnumerator::end ( u32v_t e)
inline

Definition at line 37 of file TensorSliceEnumerator.h.

37{ _end = e; }

◆ shape()

void moco::TensorSliceEnumerator::shape ( loco::TensorShape s)

◆ start()

void moco::TensorSliceEnumerator::start ( void  )

Definition at line 48 of file TensorSliceEnumerator.cpp.

49{
50 auto rank = _rank_in;
51
52 _cursor.resize(rank);
53 _boundary.resize(rank);
54 for (uint32_t r = 0; r < rank; ++r)
55 {
56 _cursor.at(r) = _begin[r];
57 _boundary.at(r) = _end[r];
58 }
59}

◆ valid()

bool moco::TensorSliceEnumerator::valid ( void  )

Definition at line 61 of file TensorSliceEnumerator.cpp.

62{
63 auto rank = _rank_in;
64 for (uint32_t r = 0; r < rank; ++r)
65 {
66 if (_cursor.at(r) >= _boundary.at(r))
67 return false;
68 }
69 return true;
70}

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