使用张量板的图形

Graph using tensorboard

如何查看使用 Tensorboard 由 TensorFlow 生成的图表?谁能提供一个简单的例子?我对张量流很陌生。我也在用 python。

提前致谢!!

您需要创建一个 tf.summary.FileWriter 将您的图形写入 TensorBoard 日志。例如:

summary_writer = tf.summary.FileWriter('logs', graph=tf.get_default_graph())
summary_writer.flush()

然后使用适当的 --logdir 参数启动 tensorboard

首先你需要创建你的计算图

import tensorflow as tf

a = tf.constant(3)
b = tf.constant(4)

c = a+b

with tf.Session() as sess:
    File_Writer = tf.summary.FileWriter('/home/theredcap/Documents/CS/Personal/Projects/Test/tensorflow/tensorboard/' , sess.graph )
    print(sess.run(c))

此处 tf.summary.FileWriter(' path to store your logs') 将图形写入 Tensorflow 日志

然后你所要做的就是使用你刚刚用

编写的提到的 log/graph 访问张量板
tensorboard --logdir "path/to/logs"

注意:当我这样做时

tensorboard --logdir = "the above mentioned path"

我的张量板上没有任何显示

了解更多信息

https://github.com/tensorflow/tensorboard/blob/master/README.md