Session

After building the graph, we have to execute it, right? For computing a graph, we should put it in a session. A Session class in TensorFlow places all ops or nodes onto computational devices such as CPU or GPU.

Here is how we create a Session object in TensorFlow:

    sess = tf.Session() 

For running the ops in a graph, the Session class provides methods to run the entire graph:

    print(sess.run(hello)) 

It will execute the op called hello and print "Hello, TensorFlow" in Terminal.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.238.161