5/3/2018 - 11:30 AM

How to export the network to use in tensorboard

Tensorboard shows the graph of the network you are using. It is usefull to debug the definition of the nodes you are using. First the graph must be written in a file and then it can be rendered as a image.

Generate the graph definition

Once the graph is defined and the session initialized, the graph is exported with:

writer = tf.summary.FileWriter("output", sess.graph)

where sess is the session object and "output" is the output folder where the definition will be stored.

Show the graph

Once the definition is stored in a file, the graph can be rendered with the command:

python -m tensorboard.main --logdir="[path to the folder with the graph definition]"

This command runs a web server and using the web browser can be seen the generated graph.