为什么张量板不显示图表?

Why tensorboard does not show the graph?

这是一个简单的代码,它使用 tensorflow 在计算图中创建单个节点:

import tensorflow as tf
tf.constant(5)
writer = tf.summary.FileWriter('./path', tf.Session().graph)
writer.close()

当我尝试使用 tensorboard 可视化此图时,没有显示任何图。这是我的终端代码:

tensorboard --logdir=[![enter image description here][1]][1]path --port 6006

我的代码有什么问题?

您的代码中没有计算图。只有一个顶点什么都不做。创建至少包含一个操作的图形:

import tensorflow as tf
a = tf.constant(5)
b = tf.constant(5)
c = a + b

with tf.Session() as sess:
    writer = tf.summary.FileWriter('path', sess.graph)
    writer.close()

你会看到的