Computational graph
TensorFlow is based on building a computational graph. A computational graph is a network of nodes, where each node defines an operation running a function; this can be as plain as addition or subtraction, or as complicated as a multivariate equation. TensorFlow programs are structured in a construction phase that assembles a graph and an execution phase that utilizes a session object to execute operations in the graph.
An operation is referred to as the op and can return zero or more tensors, which can be used later in the graph. Each op can be given a constant, array, or n-dimensional matrix.Â
Graph
The default graph gets instantiated when the TensorFlow library is imported. Constructing a graph object instead of using the default graph is useful when creating multiple models in one file that do not depend on each other. Constants and operations are added to the graph in TensorFlow.
Variables and operations applied outside of newGraph.as_default()
will get added to the...