Most of the functions in the Graph Editor library operate on sub-graph. More precisely, they take as input arguments instances of the SubGraphView class (or anything which can be converted to it). Doing so allows the same function to transparently operate on single operations as well as sub-graph of any size.
A subgraph can be created in several ways:
- using a list of ops:
my_sgv = ge.sgv(ops)
- from a name scope:
my_sgv = ge.sgv_scope("foo/bar", graph=tf.get_default_graph())
- using regular expression:
my_sgv = ge.sgv("foo/.*/.*read$", graph=tf.get_default_graph())
Note that the Graph Editor is meant to manipulate several graphs at the same time, typically during transform or copy operation. For that reason, to avoid any confusion, the default graph is never used and the graph on which to operate must always be explicitely given. This is the reason why graph=tf.get_default_graph() is used in the code snippets above.