Enable access to TensorBoard

A short guide describing how to enable TensorBoard access

TensorBoard is installed together with TensorFlow so that once you launch our Jupyter notebook, it will already be available there. In this short guide we will create some sample data that TensorBoard can visualize.


If you already have a TensorBoard log dir:

  1. Open terminal in Jupyter notebook and start it:

    export PREFIX=$(test -n "$GATEWAY_URL_PREFIX" && echo "${GATEWAY_URL_PREFIX:0:-1}-6006/" || echo "/")
    tensorboard --logdir=./graphs --port 6006 --path_prefix "$PREFIX"
  2. Go to your runners page, select your runner and click on the left button to enable the TensorBoard tunnel:

    Task button to enable TensorBoard

  3. Now, refresh your Jupyter window. Just above the notebook view you will see a TensorBoard link:

    Link to TensorBoard

That’s it, click on it and you should be able to access TensorBoard:

TensorBoard UI

Setting up TensorBoard

In order to use TensorBoard, you need to write TensorFlow summaries to files. Let’s create a simple Python script that will write a summary:

# gen.py
import tensorflow as tf
tf.reset_default_graph() # To clear the defined variables and operations of the previous cell
# create graph
a = tf.constant(2)
b = tf.constant(3)
c = tf.add(a, b)
# launch the graph in a session
with tf.Session() as sess:
    # creating the writer inside the session
    writer = tf.summary.FileWriter('./graphs', sess.graph)

Now, create a directory called graphs. Once you have the directory, run our Python script:

python gen.py

It will create a new file under graphs/ directory. In order to start TensorBoard server, use the terminal:

tensorboard --logdir=./graphs --port 6006

This will start an HTTP server inside your Jupyter notebook. To access it, follow the steps from the quick start