Purpose Of Multiple Graphs In Tensorflow
why tensorflow designed to programming with multiple graphs
ID | simple | detailed |
---|---|---|
1 | give user more control with over naming | A tf.Graph defines the namespace for tf.Operation objects: each operation in a single graph must have a unique name. TensorFlow will “uniquify” the names of operations by appending “_1”, “_2”, and so on to their names if the requested name is already taken. Using multiple explicitly created graphs gives you more control over what name is given to each operation. |
2 | simplify the construction of large graph | The default graph stores information about every tf.Operation and tf.Tensor that was ever added to it. If your program creates a large number of unconnected subgraphs, it may be more efficient to use a different tf.Graph to build each subgraph, so that unrelated state can be garbage collected. |
reference
Graphs and Sessions | TensorFlow
https://www.tensorflow.org/programmers_guide/graphs