mxnet
Classes | Public Member Functions | Friends | List of all members
nnvm::IndexedGraph Class Reference

Auxiliary data structure to index a graph. It maps Nodes in the graph to consecutive integers node_id. It also maps IndexedGraph::NodeEntry to consecutive integer entry_id. This allows storing properties of Node and NodeEntry into compact vector and quickly access them without resorting to hashmap. More...

#include <graph.h>

Collaboration diagram for nnvm::IndexedGraph:
Collaboration graph

Classes

struct  Node
 Node data structure in IndexedGraph. More...
 
struct  NodeEntry
 represents a data in the graph More...
 

Public Member Functions

size_t num_nodes () const
 
size_t num_node_entries () const
 
uint32_t entry_id (uint32_t node_id, uint32_t index) const
 Get a unique entry id between 0 to num_node_entries() for a given IndexedGraph::NodeEntry. More...
 
uint32_t entry_id (const NodeEntry &e) const
 Get a unique entry id between 0 to num_node_entries() for a given IndexedGraph::NodeEntry. More...
 
uint32_t entry_id (const nnvm::NodeEntry &e) const
 Get a unique entry id between 0 to num_node_entries() for a given NodeEntry. More...
 
uint32_t node_id (const nnvm::Node *node) const
 Get the corresponding node id for a given Node in the IndexedGraph. More...
 
const Nodeoperator[] (uint32_t node_id) const
 Get the corresponding Node structure for a given node_id. More...
 
const Nodeoperator[] (const nnvm::Node *node) const
 Get the corresponding Node structure. More...
 
const std::vector< uint32_t > & input_nodes () const
 
const std::unordered_set< uint32_t > & mutable_input_nodes () const
 
const std::vector< NodeEntry > & outputs () const
 
bool exist (const nnvm::Node *node) const
 
 IndexedGraph (const IndexedGraph &)=delete
 

Friends

class Graph
 

Detailed Description

Auxiliary data structure to index a graph. It maps Nodes in the graph to consecutive integers node_id. It also maps IndexedGraph::NodeEntry to consecutive integer entry_id. This allows storing properties of Node and NodeEntry into compact vector and quickly access them without resorting to hashmap.

The node_id and entry_rptr are the same as the JSON graph produced by SaveJSON Pass.

Constructor & Destructor Documentation

◆ IndexedGraph()

nnvm::IndexedGraph::IndexedGraph ( const IndexedGraph )
delete

Member Function Documentation

◆ entry_id() [1/3]

uint32_t nnvm::IndexedGraph::entry_id ( uint32_t  node_id,
uint32_t  index 
) const
inline

Get a unique entry id between 0 to num_node_entries() for a given IndexedGraph::NodeEntry.

Parameters
node_idThe node index
indexthe output index
Returns
the unique index.

◆ entry_id() [2/3]

uint32_t nnvm::IndexedGraph::entry_id ( const NodeEntry e) const
inline

Get a unique entry id between 0 to num_node_entries() for a given IndexedGraph::NodeEntry.

Parameters
eThe entry to query for index.
Returns
the unique index.

◆ entry_id() [3/3]

uint32_t nnvm::IndexedGraph::entry_id ( const nnvm::NodeEntry e) const
inline

Get a unique entry id between 0 to num_node_entries() for a given NodeEntry.

Parameters
eThe entry to query for index.
Returns
the unique index.

◆ exist()

bool nnvm::IndexedGraph::exist ( const nnvm::Node node) const
inline
Returns
whether a node is existed in the indexed graph

◆ input_nodes()

const std::vector<uint32_t>& nnvm::IndexedGraph::input_nodes ( ) const
inline
Returns
list of argument nodes

◆ mutable_input_nodes()

const std::unordered_set<uint32_t>& nnvm::IndexedGraph::mutable_input_nodes ( ) const
inline
Returns
list of mutable nodes

◆ node_id()

uint32_t nnvm::IndexedGraph::node_id ( const nnvm::Node node) const
inline

Get the corresponding node id for a given Node in the IndexedGraph.

Parameters
nodeThe Node to query for index.
Returns
the node index.

◆ num_node_entries()

size_t nnvm::IndexedGraph::num_node_entries ( ) const
inline
Returns
total number of NodeEntry in the graph

◆ num_nodes()

size_t nnvm::IndexedGraph::num_nodes ( ) const
inline
Returns
number of nodes in the graph

◆ operator[]() [1/2]

const Node& nnvm::IndexedGraph::operator[] ( uint32_t  node_id) const
inline

Get the corresponding Node structure for a given node_id.

Parameters
node_idThe node id
Returns
const reference to the corresponding IndexedGraph::Node

◆ operator[]() [2/2]

const Node& nnvm::IndexedGraph::operator[] ( const nnvm::Node node) const
inline

Get the corresponding Node structure.

Parameters
nodeThe pointer to the Node structure
Returns
const reference to the corresponding IndexedGraph::Node

◆ outputs()

const std::vector<NodeEntry>& nnvm::IndexedGraph::outputs ( ) const
inline
Returns
list of output entries

Friends And Related Function Documentation

◆ Graph

friend class Graph
friend

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