Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dragon::GraphOptimizer Class Reference

#include <graph_optimizer.h>

Classes

struct  Node
 The simple node structure. More...
 

Public Member Functions

 GraphOptimizer (Workspace *ws)
 Default constructor. More...
 
GraphDef PruneNodes (const GraphDef &input_def)
 Prune the redundant nodes (-O1) More...
 
GraphDef AddInplace (const GraphDef &input_def)
 Add the inplace for outputs (-O2) More...
 
GraphDef MirrorStage (const GraphDef &input_def, Map< string, vec32_t > &op_indices)
 Plan the recomputing for inputs (-O3) More...
 
GraphDef SimulateGC (const GraphDef &input_def)
 Allocate the buffer for outputs (-O3) More...
 

Protected Member Functions

void ForwardPruneTraversal (const string &u, const string &leaf, const vector< string > &path)
 Traverse from input gradients to dying the nodes. More...
 
void BackwardPruneTraversal (const string &v)
 Traverse from targets to dying the nodes. More...
 
void InplaceTraversal (const string &u, const string &ancestor)
 Traverse from inputs to find the available inplace chain. More...
 

Protected Attributes

Workspacews_
 
Map< string, Nodedag_
 
Map< string, bool > visited_
 
Map< string, bool > colored_
 
Map< string, string > renamed_
 

Constructor & Destructor Documentation

◆ GraphOptimizer()

dragon::GraphOptimizer::GraphOptimizer ( Workspace ws)
inline

Default constructor.

Member Function Documentation

◆ AddInplace()

GraphDef dragon::GraphOptimizer::AddInplace ( const GraphDef &  input_def)

Add the inplace for outputs (-O2)

◆ BackwardPruneTraversal()

void dragon::GraphOptimizer::BackwardPruneTraversal ( const string &  v)
protected

Traverse from targets to dying the nodes.

◆ ForwardPruneTraversal()

void dragon::GraphOptimizer::ForwardPruneTraversal ( const string &  u,
const string &  leaf,
const vector< string > &  path 
)
protected

Traverse from input gradients to dying the nodes.

◆ InplaceTraversal()

void dragon::GraphOptimizer::InplaceTraversal ( const string &  u,
const string &  ancestor 
)
protected

Traverse from inputs to find the available inplace chain.

◆ MirrorStage()

GraphDef dragon::GraphOptimizer::MirrorStage ( const GraphDef &  input_def,
Map< string, vec32_t > &  op_indices 
)

Plan the recomputing for inputs (-O3)

◆ PruneNodes()

GraphDef dragon::GraphOptimizer::PruneNodes ( const GraphDef &  input_def)

Prune the redundant nodes (-O1)

◆ SimulateGC()

GraphDef dragon::GraphOptimizer::SimulateGC ( const GraphDef &  input_def)

Allocate the buffer for outputs (-O3)

Member Data Documentation

◆ colored_

Map<string, bool> dragon::GraphOptimizer::colored_
protected

◆ dag_

Map<string, Node> dragon::GraphOptimizer::dag_
protected

◆ renamed_

Map<string, string> dragon::GraphOptimizer::renamed_
protected

◆ visited_

Map<string, bool> dragon::GraphOptimizer::visited_
protected

◆ ws_

Workspace* dragon::GraphOptimizer::ws_
protected

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