Graph representation of a Netdef. More...
#include <graph.h>
Public Member Functions  
const std::vector< std::pair< string, int > >  GetSubgraphInput (const std::vector< int > &subgraph) 
Given a subgraph, gets all of the parents of the subgraph, as well as their associated blob names. More...  
const std::vector< std::pair< string, int > >  GetSubgraphOutput (const std::vector< int > &subgraph) 
Given a subgraph, gets all of the children of the subgraph, as well as their associated blob names. More...  
Graph (const NetDef &net_def)  
Graph generation. More...  
NetDef  GetNetDef () 
Generates a NetDef Representation for the current graph. More...  
void  DeactivateSubgraph (std::vector< int > subgraph) 
Deactivate a subgraph, and get rid of all edges into this subgraph.  
const size_t  size () const 
void  push_node (const Node &new_node) 
void  resize_nodes (size_t new_size) 
const Node &  node (size_t idx) const 
Node &  node (size_t idx) 
bool  is_node_active (size_t idx) 
const std::set< string > &  external_input () const 
const std::set< string > &  external_output () const 

explicit 
Graph generation.
Given a netdef, returns a Graph.
Each node represents an operator. An edge exists between two nodes if the parent op writes to a blob, which is the input of the child blob, with no other op writing to the blob in between the execution order.
Time Complexity: O(E), where E is the number of blobs
NetDef caffe2::transform::Graph::GetNetDef  (  ) 
Generates a NetDef Representation for the current graph.
Nodes are visited in topological order, which is proper Opdef ordering. TODO(benz): There exists conflicts with repeated blob names, where topological sorting is not sufficient for correct netdef representation, unless blobs are renamed. For example, if after a transformation, We have operator ancestry: A –> B –> C, and also A –> D –> E, where B > C and D > E uses the same blob name, then A, B, D, E, C is a correct topological ordering, but D will write to the blob that C reads from, instead of B. Currently believe that there will always be ambiguity unless blobs are renamed. This is solved by performing SSA on all transformed blob names.
const std::vector< std::pair< string, int > > caffe2::transform::Graph::GetSubgraphInput  (  const std::vector< int > &  subgraph  ) 
const std::vector< std::pair< string, int > > caffe2::transform::Graph::GetSubgraphOutput  (  const std::vector< int > &  subgraph  ) 