0

在 docker 上运行 Tensorflow 和 Tensorboard。

我试图编写最简单的代码来演示 tensorboard 的工作原理:

graph = tf.Graph()
with graph.as_default(), tf.device('/cpu:0'):
  a = tf.constant(5.0)
  b = tf.constant(6.0)
  c = a * b

  # Enter data into summary.
  c_summary = tf.scalar_summary("c", c)
  merged = tf.merge_all_summaries()

with tf.Session(graph=graph) as session:
  writer = tf.train.SummaryWriter("log/test_logs", session.graph_def)

  result = session.run([merged])
  tf.initialize_all_variables().run()
  writer.add_summary(result[0], 0)

然后我跑了tensorboard --logdir={absolute path to log/test_logs},但那里没有列出任何事件。有什么我应该在代码中写不同的东西吗?

请注意,它log/test_logs确实包含像events.out.tfevents.1459102927.0a8840dee548.

4

1 回答 1

0

I am not sure whether it is your case.

SummaryWriter by default will store summaries in its buffer, it will flush every period of time(I guess 120 seconds? Not sure).

So maybe you just did not wait until your the flush happens. Try to manually flush SummaryWriter or just close() it at the end of your program.

于 2016-05-23T02:05:43.543 回答