mxnet
Public Member Functions | Public Attributes | List of all members
nnvm::Graph Class Reference

Symbolic computation graph. This is the intermediate representation for optimization pass. More...

#include <graph.h>

Collaboration diagram for nnvm::Graph:
Collaboration graph

Public Member Functions

template<typename T >
const T & GetAttr (const std::string &attr_name) const
 Get the immutable attribute from attrs. More...
 
bool HasAttr (const std::string &attr_name) const
 Check whether has a specific attribute. More...
 
template<typename T >
MoveCopyAttr (const std::string &attr_name)
 Get a move copy of the attribute, implement copy on write semantics. The content is moved if the reference counter of shared_ptr is 1. The attribute is erased from attrs after the call. More...
 
const IndexedGraphindexed_graph () const
 get a indexed graph of current graph, if not exist, create it on demand More...
 

Public Attributes

std::vector< NodeEntryoutputs
 outputs of the computation graph. More...
 
std::unordered_map< std::string, std::shared_ptr< any > > attrs
 attributes of a graph Note that attribute is shared pointer and can be shared across graphs. More...
 

Detailed Description

Symbolic computation graph. This is the intermediate representation for optimization pass.

Member Function Documentation

template<typename T >
const T & nnvm::Graph::GetAttr ( const std::string &  attr_name) const
inline

Get the immutable attribute from attrs.

Parameters
attr_namethe name of the attribute
Returns
the reference to corresponding attribute
Template Parameters
Tthe type of the attribute.
bool nnvm::Graph::HasAttr ( const std::string &  attr_name) const
inline

Check whether has a specific attribute.

Parameters
attr_namethe name of the attribute
Returns
a boolean result
const IndexedGraph& nnvm::Graph::indexed_graph ( ) const

get a indexed graph of current graph, if not exist, create it on demand

Returns
The indexed graph.
See also
IndexedGraph
template<typename T >
T nnvm::Graph::MoveCopyAttr ( const std::string &  attr_name)
inline

Get a move copy of the attribute, implement copy on write semantics. The content is moved if the reference counter of shared_ptr is 1. The attribute is erased from attrs after the call.

Parameters
attr_namethe name of the attribute
Returns
a new copy of the corresponding attribute.
Template Parameters
Tthe type of the attribute.

Member Data Documentation

std::unordered_map<std::string, std::shared_ptr<any> > nnvm::Graph::attrs

attributes of a graph Note that attribute is shared pointer and can be shared across graphs.

It is highly recommended to keep each attribute immutable. It is also safe to implement an copy-on-write semnatics.

Copy when shared_ptr.unique is not true, while reuse original space when shared_ptr.unique is true.

std::vector<NodeEntry> nnvm::Graph::outputs

outputs of the computation graph.


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