tensorflow / tensorboard

TensorFlow's Visualization Toolkit
Apache License 2.0
6.68k stars 1.65k forks source link

Error loading graph in tensorboard with placeholder named "length" #1283

Open TanguyMoreau opened 6 years ago

TanguyMoreau commented 6 years ago

Tensorflox-gpu : 1.8.0 Tensorboard : 1.8.0 Python : 3.6.5 Distribution : Ubuntu 16.04.4 LTS

Description of the problem :

When adding a graph to visualize it in tensorboard, the graph does not print. image This problem does not seem to depend on the browser (we tested chrome, firefox and safari). Also the console log of the browser shows this error : Browser console log
![tensorboard_bug](https://user-images.githubusercontent.com/16269358/42632368-3922ab42-85dd-11e8-8f09-4e230624fbe8.png)

Minimal example of the problem :

Import tensorflow as tf

graph = tf.Graph()
with graph.as_default():
   var1 = tf.placeholder(dtype=tf.int32, shape=(None), name="wedontcare")
   var2 = tf.placeholder(dtype=tf.float32, shape=(None), name="length")
with tf.Session(graph=graph) as sess:
   sess.run(tf.global_variables_initializer())
   writer = tf.summary.FileWriter("graph/")
   writer.add_graph(sess.graph)

What we tried :

1) It seems the problem occurs when the name name="length" is specified in a placeholder. This example works fine :

Import tensorflow as tf

graph = tf.Graph()
with graph.as_default():
   # No palceholder name "length"
   var1 = tf.placeholder(dtype=tf.int32, shape=(None), name="wedontcare")
   var2 = tf.placeholder(dtype=tf.float32, shape=(None), name="thisworks")  
with tf.Session(graph=graph) as sess:
   sess.run(tf.global_variables_initializer())
   writer = tf.summary.FileWriter("graph/")
   writer.add_graph(sess.graph)

2) Also it seems we need at least two placeholders to trigger the prolbem. This example works fine :

Import tensorflow as tf

graph = tf.Graph()
with graph.as_default():
   # Only one placeholder
   var2 = tf.placeholder(dtype=tf.float32, shape=(None), name="length")
with tf.Session(graph=graph) as sess:
   sess.run(tf.global_variables_initializer())
   writer = tf.summary.FileWriter("graph/")
   writer.add_graph(sess.graph)

3) Finally it seems we need at least one placeholder stated before the one with name="length" to trigger the problem. This example works fine :

Import tensorflow as tf

graph = tf.Graph()
with graph.as_default():
   # the name "length" placeholder is stated first
   var2 = tf.placeholder(dtype=tf.float32, shape=(None), name="length")   
   var1 = tf.placeholder(dtype=tf.int32, shape=(None), name="wedontcare")
with tf.Session(graph=graph) as sess:
   sess.run(tf.global_variables_initializer())
   writer = tf.summary.FileWriter("graph/")
   writer.add_graph(sess.graph)

Note that you may have weird behaviours when overwritting the graph with newest events, so be sure to clear old events before testing a case and conclude.

nfelt commented 6 years ago

Thank you very much for the detailed examples! We have some suspicion of what might be causing this and will investigate.

nfelt commented 4 years ago

Very belated response, but I was able to reproduce this still on TensorBoard 2.1 (thank you very much for the detailed code samples!) and confirmed that it's a bug in the graph layout library we use, which I've reported upstream: https://github.com/dagrejs/dagre/issues/285

Ideally they will fix it there. We might also be able to work around this by prefixing the node names when passing them into dagre so it doesn't match "length" exactly, but this is likely a nontrivial amount of work to update everywhere.