张量板中没有显示图表

No graph is shown in tensorboard

我是 Tensorflow 初学者。我正在关注这个 tutorial 下面的代码来自:

import tensorflow as tf

x = tf.constant(1.0, name="input")
w = tf.Variable(0.8, name="weight")
y = tf.multiply(x, w, name="output")
y_ = tf.constant(0.0, name="correct_value")
loss = tf.pow(y - y_, 2, name="loss")

train_step = tf.train.GradientDescentOptimizer(learning_rate=0.025).minimize(loss)

for value in [x, w, y, y_, loss]:
    tf.summary.scalar(value.op.name, value)

summaries = tf.summary.merge_all()

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    writer = tf.summary.FileWriter("/tmp/fn")
    writer.add_graph(sess.graph)

    for i in range(100):
        writer.add_summary(sess.run(summaries), i)
        sess.run(train_step)

writer.close()

每次我尝试 运行 Tensorboard 时,我都会得到“没有找到图形定义文件”:

Tensorboard: No graph definition files where found

我使用了 --debug 参数并找到了事件文件。我还使用了 --inspect 参数生成了这个:

C:\WINDOWS\system32>tensorboard --inspect --logdir="D:\tmp\fn"
======================================================================
Processing event files... (this can take a few minutes)
======================================================================

Found event files in:
D:\tmp\fn

These tags are in D:\tmp\fn:
audio -
histograms -
images -
scalars
   correct_value_1
   input_1
   loss_1
   output_1
   weight_1
tensor -
======================================================================

Event statistics for D:\tmp\fn:
audio -
graph
   first_step           0
   last_step            0
   max_step             0
   min_step             0
   num_steps            1
   outoforder_steps     []
histograms -
images -
scalars
   first_step           0
   last_step            99
   max_step             99
   min_step             0
   num_steps            100
   outoforder_steps     []
sessionlog:checkpoint -
sessionlog:start -
sessionlog:stop -
tensor -
======================================================================

我认为我的代码有问题。该代码与教程中的代码几乎相同,但我更改了一些内容,因为教程使用的是与我不同的其他版本的 Tensorflow。我在 Windows 10.

上使用 Tensorflow 1.3 GPU

我做错了什么?谢谢

您可以在代码中添加以下行。

tf.train.write_graph(sess.graph_def, '/tmp/fn', 'graph.pb', False)

问题是 TensorBoard 不遵守 Windows 上的驱动器名称。问题解决here.