Reputation: 31
I have used tensorboard in several projects previously and it has worked great. When I run those projects now it still works. However, in a new project the summary scalars I have saved will not show up. The graph is there and appears correct but the "No scalar data was found" dialogue is under the scalars tab. I tried to write the simplest code I could think of as a test and it's still not working:
import tensorflow as tf
tf.reset_default_graph()
g = tf.Graph()
with g.as_default():
y = tf.Variable(1)
initialize = tf.global_variables_initializer()
tf.summary.scalar('thing',y)
sess = tf.InteractiveSession(graph=g)
sess.run(initialize)
merged = tf.summary.merge_all()
writer = tf.summary.FileWriter("path",g)
for i in range(10):
summary = sess.run(merged)
writer.add_summary(summary,i)
sess.close()
I'm thinking this should just give me a constant y value over 10 steps, but no scalars in tensorboard. Have I made some mistake?
Upvotes: 3
Views: 4497
Reputation: 53758
Try to change the graph definition to:
with g.as_default():
y = tf.Variable(1)
tf.summary.scalar('thing', y)
initialize = tf.global_variables_initializer()
I.e., first define a summary op, then the initialization op. This way it appears on tensorboard:
It's also possible that the summary wasn't flushed, in this case writer.flush()
will help.
Upvotes: 0