A computational graph is a series of TensorFlow operations arranged into a graph. The graph is composed of two types of objects.
tf.Operation (or “ops”): The nodes of the graph. Operations describe calculations that consume and produce tensors.
tf.Tensor: The edges in the graph. These represent the values that will flow through the graph. Most TensorFlow functions return tf.Tensors.
Quoting from TensorFlow – Guide – Low Level APIs – Introduction
What is a tf.Graph?
A tf.Graph contains two relevant kinds of information:
Graph structure. The nodes and edges of the graph, indicating how individual operations are composed together, but not prescribing how they should be used. The graph structure is like assembly code: inspecting it can convey some useful information, but it does not contain all of the useful context that source code conveys.
Graph collections. TensorFlow provides a general mechanism for storing collections of metadata in a tf.Graph. The tf.add_to_collection function enables you to associate a list of objects with a key (where tf.GraphKeys defines some of the standard keys), and tf.get_collection enables you to look up all objects associated with a key. Many parts of the TensorFlow library use this facility: for example, when you create a tf.Variable, it is added by default to collections representing “global variables” and “trainable variables”. When you later come to create a tf.train.Saver or tf.train.Optimizer, the variables in these collections are used as the default arguments.
Graph && Session
Graph是用来定义操作和变量的. 定义好了之后, 交给Session进行加载和计算. Session同时管理资源.