ONE - On-device Neural Engine
|
A collection of (abstracted) elements of the same type. More...
#include <Bag.h>
Data Structures | |
struct | Reader |
struct | Updater |
Public Types | |
using | UpdaterSet = std::set< Updater * > |
using | ReaderSet = std::set< Reader * > |
Public Member Functions | |
Bag (uint32_t size) | |
~Bag () | |
uint32_t | size (void) const |
bool | isInput (void) const |
bool | isOutput (void) const |
const DepSet * | deps (void) const |
Return the set of Dep links that point to this bag. | |
const ReadSet * | reads (void) const |
Return the set of Read links that point to this bag. | |
const UpdateSet * | updates (void) const |
Return the set of Update links that point to this bag. | |
Input * | input (void) const |
Return a valid pointer if this bag is marked as an input of the model. | |
Output * | output (void) const |
Return a valid pointer if this bag is marked as an output of the model. | |
void | replaceWith (Bag *b) |
Replace all the occurence of a bag (except those in Input/Output) with another bag. | |
void | replaceAllDepsWith (Bag *) |
Replace all the occurence of a bag in Object with another bag. | |
Public Member Functions inherited from coco::Entity | |
virtual | ~Entity ()=default |
Module * | module (void) const |
Friends | |
class | Dep |
class | Read |
class | Update |
class | Input |
class | Output |
A collection of (abstracted) elements of the same type.
When there are N elements in a bag, we refer to N as the size of this bag, and every element in a bag has a unique numeric ID whose range is [0, N).
NOTE 'Bag' is not a container (such as std::vector). 'Bag' just assures that there are N elements. It does not state about its value.
NOTE coco IR treats Bag as virtual memory allocation
using coco::Bag::ReaderSet = std::set<Reader *> |
using coco::Bag::UpdaterSet = std::set<Updater *> |
|
explicit |
coco::Bag::~Bag | ( | ) |
Definition at line 33 of file Bag.cpp.
const DepSet * coco::Bag::deps | ( | void | ) | const |
Return the set of Dep links that point to this bag.
Definition at line 46 of file Bag.cpp.
Referenced by coco::Dep::bag(), replaceAllDepsWith(), replaceWith(), and ~Bag().
|
inline |
bool coco::Bag::isInput | ( | void | ) | const |
bool coco::Bag::isOutput | ( | void | ) | const |
Definition at line 44 of file Bag.cpp.
Referenced by replaceWith().
|
inline |
const ReadSet * coco::Bag::reads | ( | void | ) | const |
Return the set of Read links that point to this bag.
Definition at line 47 of file Bag.cpp.
Referenced by replaceWith(), and ~Bag().
void coco::Bag::replaceAllDepsWith | ( | Bag * | b | ) |
Replace all the occurence of a bag in Object with another bag.
NOTE Unlike replaceWith(b), replaceAllDepsWith(b) has no restriction
Definition at line 76 of file Bag.cpp.
References deps().
Referenced by enco::hoist_object(), and replaceWith().
void coco::Bag::replaceWith | ( | Bag * | b | ) |
Replace all the occurence of a bag (except those in Input/Output) with another bag.
NOTE reaplceWith(b) works correctly only when b is neither Input nor Output
Definition at line 50 of file Bag.cpp.
References deps(), isInput(), isOutput(), reads(), replaceAllDepsWith(), and updates().
uint32_t coco::Bag::size | ( | void | ) | const |
Definition at line 41 of file Bag.cpp.
Referenced by enco::SubnetBlockCompiler::compile(), and ~Bag().
const UpdateSet * coco::Bag::updates | ( | void | ) | const |
Return the set of Update links that point to this bag.
Definition at line 48 of file Bag.cpp.
Referenced by replaceWith(), and ~Bag().