In this minimal example, Tensorboard doesn't display my summaries during execution unless I use writer.flush()
:
from time import sleep
import tensorflow as tf
import numpy as np
x = tf.placeholder("float", [None, 2])
mean = tf.reduce_mean(x)
tf.scalar_summary("mean", mean)
init = tf.initialize_all_variables()
merged = tf.merge_all_summaries()
with tf.Session() as sess:
sess.run(init)
summary_writer = tf.train.SummaryWriter('/var/tmp/tf_log', graph=sess.graph)
x_iter = np.random.rand(2,2)
for ind in range(30):
merged_summary = sess.run(merged, feed_dict={x: x_iter})
summary_writer.add_summary(merged_summary, ind)
summary_writer.flush()
x_iter += 1.0
sleep(1)
When the run is finished the scalar is displayed just fine.
The mnist_with_summaries
example displays summaries during execution just fine.
When do I need to use flush()
? Is this due to buffers not filling?
Looks like it's indeed buffers.
When I add some other huge summary (e.g. tf.audio_summary("x", x, 1)
) there's no need to flush()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With