Slawek S
Slawek S

Reputation: 29

Tensorboard: No graph definition files were found.

In my Python code I execute train_writer = tf.summary.FileWriter(TBOARD_LOGS_DIR) train_writer.add_graph(sess.graph)

I can see 1.6MB file created in E:\progs\tensorboard_logs (and no other file) but then when I execute tensorboard --logdir=E:\progs\tensorboard_logs it loads, but says: "No graph definition files were found." when I click on Graph. Additionally, running tensorboard --inspect --logdir=E:\progs\tensorboard_logs displays Found event files in: E:\progs\tensorboard_logs

These tags are in E:\progs\tensorboard_logs: audio - histograms - images -

scalars -

Event statistics for E:\progs\tensorboard_logs: audio - graph first_step 0 last_step 0 max_step 0 min_step 0 num_steps 1 outoforder_steps [] histograms - images - scalars - sessionlog:checkpoint - sessionlog:start -

sessionlog:stop -

This is TF 1.01 or so, on Windows 10.

Upvotes: 2

Views: 5362

Answers (4)

sharmistha maitra
sharmistha maitra

Reputation: 31

In Tensorflows dealing with graphs, there are three parts: 1) creating the graph 2) Writing the graph to event file 3) Visualizing the graph in tensorboard

Example: Creating graph in tensorflow

a = tf.constant(5, name="input_a")
b = tf.constant(3, name="input_b")

c = tf.multiply(a,b, name="mul_c")
d = tf.add(a,b, name="add_d")

e = tf.add(c,d, name="add_e")

sess = tf.Session() 

sess.run(c) <--check, value should be 15
sess.run(d) <--check, value should be 8
sess.run(e) <--check, value should be 23

Writing graph in event file

 writer = tf.summary.FileWriter('./tensorflow_examples', sess.graph)

It is very important to specify a directory(in this case, the directory is tensorflow_examples), where the event file will be written to. writer = tf.summary.FileWriter('./', sess.graph) didnt work for me, because the shell command => tensorboard --logdir expects a directory name.

After executing this step, verify if event file has been created in specified directory.

Visualizing graph in Tensorboard

Open terminal(bash), under working directory type: tensorboard --logdir='tensorflow_examples' --host=127.0.0.1

Then open a new browser in http://127.0.0.1:6006/ or http://localhost/6006 and now tensorboard shows the graph successfully.

Upvotes: 3

Jason Wang
Jason Wang

Reputation: 23

You may need to change the powershell directory to your log file. And the logdir need not the single quotation marks.(Double quotation marks or without the quotes will be both OK)

Upvotes: 0

alt_gamma
alt_gamma

Reputation: 31

I had similar issue. The issue occurred when I specified 'logdir' folder inside single quotes instead of double quotes. Hope this may be helpful to you.

egs: tensorboard --logdir='my_graph' -> Tensorboard didn't detect the graph

 tensorboard --logdir="my_graph"  -> Tensorboard detected the graph

Upvotes: 3

Leoli
Leoli

Reputation: 749

The problem might be the parameter --logdir. make sure you have type the correct

example:

in the code: writer = tf.summary.FileWriter('./log/', s.graph)

open powershell

cd to your work directory and type tensorboard --logdir=log

you can also use --debug to see if there is a problem in finding the log file. if you see: TensorBoard path_to_run is: {'C:\\Users\\example\\log': None} that means it can not find the file.

Upvotes: 2

Related Questions