我正在尝试使TensorBoard运行。我哪里做错了?

时间:2018-08-05 20:11:46

标签: tensorflow tensorboard

这是我编写的与TensorBoard相关的代码:

loss_op =tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits_train, labels=tf.cast(labels, 
dtype=tf.int32)))

tf.summary.scalar('loss', loss_op)

merged = tf.summary.merge_all()
write = tf.summary.FileWriter( "/tmp/mnist_logs")

当我去C:/ tmp / mnist_logs训练网络后,它是空的

1 个答案:

答案 0 :(得分:0)

您需要在会话中执行合并的操作(merged),并将结果提供给FileWriter。尝试这样的事情:

merged = tf.summary.merge_all()
write = tf.summary.FileWriter( "/tmp/mnist_logs")
with tf.Session() as sess:
    ...
    summary = sess.run(merged)
    write.add_summary(summary)
    write.flush()