In the previous section, we knew how to build a computational graph, but we need to actually run it and get its value.
We can deploy/run the graph with something called a session, which is just a binding to a particular execution context such as a CPU or a GPU. So, we are going to take the graph that we build and deploy it to a CPU or a GPU context.
To run the graph, we need to define a session object called sess, and we are going to call the function run which takes two arguments:
sess.run(fetches, feeds)
Here:
- fetches are the list of the graph nodes that return the output of the nodes. These are the nodes we are interested in computing the value of.
- feeds are going to be a dictionary mapping from graph nodes to actual values that we want to run in our model. So, this is where we actually fill in the placeholders that we talked about earlier.