16

launch tensorboard with tensorboard --logdir=/home/vagrant/notebook

at tensorboard:6006 > graph, it says No graph definition files were found.

To store a graph, create a tf.python.training.summary_io.SummaryWriter and pass the graph either via the constructor, or by calling its add_graph() method.

import tensorflow as tf sess = tf.Session() writer = tf.python.training.summary_io.SummaryWriter("/home/vagrant/notebook", sess.graph_def) 

However the page is still empty, how can I start playing with tensorboard?

current tensorboard

Current Tensorboard

result wanted

An empty graph that can add nodes, editable.

update

Seems like tensorboard is unable to create a graph to add nodes, drag and edit etc ( I am confused by the official video ).

running https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/tutorials/mnist/fully_connected_feed.py and then tensorboard --logdir=/home/vagrant/notebook/data is able to view the graph

However seems like tensorflow only provide ability to view summary, nothing much different to make it standout

2
  • what do you mean by empty? Is it not launching? Blank (white/grey page)? You can not see the graph? graph is not the one you expect? Commented Nov 12, 2015 at 2:08
  • The PR video is indeed misleading. I thought so too. Commented Feb 15, 2016 at 15:32

7 Answers 7

15

TensorBoard is a tool for visualizing the TensorFlow graph and analyzing recorded metrics during training and inference. The graph is created using the Python API, then written out using the tf.train.SummaryWriter.add_graph() method. When you load the file written by the SummaryWriter into TensorBoard, you can see the graph that was saved, and interactively explore it.

However, TensorBoard is not a tool for building the graph itself. It does not have any support for adding nodes to the graph.

Sign up to request clarification or add additional context in comments.

Comments

12

Starting from the following Code Example, I can add one line as shown below:

import tensorflow as tf import numpy as np sess = tf.InteractiveSession() #define a session # Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3 x_data = np.random.rand(100).astype("float32") y_data = x_data * 0.1 + 0.3 # Try to find values for W and b that compute y_data = W * x_data + b # (We know that W should be 0.1 and b 0.3, but Tensorflow will # figure that out for us.) W = tf.Variable(tf.random_uniform([1], -1.0, 1.0)) b = tf.Variable(tf.zeros([1])) y = W * x_data + b # Minimize the mean squared errors. loss = tf.reduce_mean(tf.square(y - y_data)) optimizer = tf.train.GradientDescentOptimizer(0.5) train = optimizer.minimize(loss) # Before starting, initialize the variables. We will 'run' this first. init = tf.initialize_all_variables() # Launch the graph. sess = tf.Session() sess.run(init) #### ----> ADD THIS LINE <---- #### writer = tf.train.SummaryWriter("/tmp/test", sess.graph) # Fit the line. for step in xrange(201): sess.run(train) if step % 20 == 0: print(step, sess.run(W), sess.run(b)) # Learns best fit is W: [0.1], b: [0.3] 

And then run tensorboard from the command line, pointing to the appropriate directory. This shows a complete call for the SummaryWriter. It is important to note the following things:

  1. SummaryWriter is passed a Session, and so must happen after the Session (or InteractiveSession) is created
  2. That Session may be created early in the program, but when the Session is passed to the SummaryWriter, the graph as it exists at that point is written to the file that the TensorBoard will use.

1 Comment

tf.train.SummaryWriter has morphed to tf.summary.FileWriter. If you make that change this example works.
2

In this page, there is a very simple code that you can use to test your installation: http://tensorflow.org/get_started

I included this line

tf.train.write_graph(sess.graph_def, '/home/daniel/Documents/Projetos/Prorum/ProgramasEmPython/TestingTensorFlow/fileGraph', 'graph.pbtxt') 

After this "sess.run(init)"

This will generate a file that you have to upload to the "TensorBoard".

In order to open the TensorBoard, supposing that it is installed in your computer (it must be if you use pip to install), I used the terminal of Ubuntu and wrote:

"tensorboard --logdir nameOfDirectory"

Then, you should open your browser in Port 6006:

http://localhost:6006/ 

This will open the TensorBoard. I went to the "Graph Menu" and uploaded the file. It generated this figure below:

http://www.prorum.com

So, what I have done is to transfer the model I created in Python to TensorBoard. I believe that it is possible to create an empty one, if no model is created (only the session is initiated). However, I am not sure if you are able to change this directly in the TensorBoard.

I have answered before this question here in Portuguese with more details for Brazilian users. Maybe it can be useful for other people: http://prorum.com/index.php/1843/recentemente-plataforma-aprendizagem-primeira-impressao

4 Comments

This does not seem to work. The modified program runs, the output file is created, but Tensorboard gives the same error as reported by original poster
It worked for me! I spent some hours to discover this! I am using ubuntu 14.04 and I tried this on Chromium!
I hear you on the discovery process. I used Ubuntu 15.1, with Chrome and Chromium, and the upgraded Tensorflow 0.6. If/when I get it working (probably a few days) I will comment or post a separate answer.
I found that some processes related to tensorBoard were intermittent (sometimes worked and other times didnt work), but I do not remember exactly the situations that it happened. Maybe something like this is happening in your case! In these cases, I tried to repeat more than once to make it happen as expected!
2

i solved by on windows:

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

for that directory "output". I opened command on windows.

typed

tensorboard --logdir="C:\Users\kiran\machine Learning\output" 

my mistake was on that line..

Comments

0

The graphs in TensorBoard do not show up if you are using Firefox. You have to install Chrome.

Comments

0

result wanted

An empty graph that can add nodes, editable.

I think you will find the Orange tool useful. It allows you to drag and drop various nodes and implement algorithms via GUI.

Comments

0

I had to use

python -m tensorflow.tensorboard --logdir="C:\tmp\tensorflow\.." 

somehow tensorboard --logdir didn't work.

My environment

OS: Windows 7, Python 3.5, and Tensorflow 1.1.0

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.