Tensorflow 3: Tensorboard Basics

Expanding from my previous post:

I will create a new jupyter notebook called 3_TensorboardBasics.ipynb.  All my code can be found on github.

Tensorboard

Tensorflow comes with a program to help visualize the computational graph called Tensorboard.  Tensorboard is very useful and powerful and ill show you how to get up and running with it.

To see what this is we will create a more complicated example.

This introduces two new Tensorflow commmands (add, multiply) that work as expected.

The interesting line is:

This creates a new directory called my_graph in the jupyter notebook directory.

 

 

To view the contents of this file we need to run a Tensorboard.

run the following command.

You access the Tensorboard via a webrowser at http://127.0.0.1:6006.  Click on the Graphs tab up the top to view the graph you just made.

Naming

Looking at above its very hard to tell what is what.  Luckily Tensorflow allows you to name the parts of your graph.

I will name each part and also place them all into a namescope which groups items together.

Now the graph appears as:

and when clicked expands to show the inner parts also named.

Note when using Tensorboard with jupyter it will often cache results so you may need to restart both jupyter, tensorboard and delete the log file.

Script

I like to use the following script when executing native python code.

Which is executed by running:  ./RUNNER

 

 

 

This will change to your virtual environment, execute the python script and run Tensorboard.

Move onto the next item.