TensorFlow Graphs

TensorFlow can create more advanced graphs. A graph doesn’t have to be just 3 nodes.

You can create large graphs and graphs with subgraphs. You can visualize this with TensorBoard.

Related Course:
Complete Guide to TensorFlow for Deep Learning with Python


In tensorflow we define graphs. These graphs show the operations in the session. The example below creates a graph with more nodes:

import tensorflow as tf

x = 1
y = 6

op1 = tf.add(x,y)
op2 = tf.add(x,y)
op3 = pow(op1, op2)

with tf.Session() as ses:
writer = tf.summary.FileWriter('./graphs', ses.graph)

Save it and run it with Python. Then open it with TensorBoard and this graph should show up:

tensorflow graph


Subgraphs are also possible, you could have something like:

op1 = tf.add(x,y)
op2 = tf.add(x,y)
op3 = tf.pow(op1, op2)
thing = tf.multiply(x, op1)

A subgraph is possible to break into chunks, each can be run on a different CPU or GPU.

Can you make more than one graph?

You can build more than one graph, but that doesn’t work distributed.

The session runs the default graph. You should have disconnected subgraphs in a graph.

Previous Post Next Post

Cookie policy | Privacy policy | ©

Deep Learning