【问题标题】:Launching Tensorboard - NameError: name 'tensorboard' is not defined启动 Tensorboard - NameError: name 'tensorboard' is not defined
【发布时间】:2017-03-08 22:27:02
【问题描述】:

我正在尝试启动 tensorboard 并查看我创建的图表。

import tensorflow as tf

logPath = "C:\\path\\to\\log" -- can also be /path/to/log

sess = tf.Session()
file_writer = tf.summary.FileWriter(logPath, sess.graph)

这段代码运行良好,并在正确的文件夹中创建了一个事件文件,但是当我在 shell 中运行这个命令时:

tensorboard --logdir /path/to/log

我收到以下错误:

Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
tensorboard --logdir /path/to/log
NameError: name 'tensorboard' is not defined

我是否缺少设置?我已经看到有关此错误的另一个问题,但该解决方案并未解决此问题。

我已经能够分配节点并纯粹在命令行中工作,好吧,我只想开始测试可视化。

非常感谢。

【问题讨论】:

    标签: python tensorflow tensorboard


    【解决方案1】:

    您是否尝试在脚本顶部添加:

    from keras.callbacks import TensorBoard
    

    【讨论】:

    • 这有助于您使用 keras。
    【解决方案2】:

    从错误消息来看,您似乎在 Python shell 中输入了命令 tensorboard。但是,tensorboard 实际上是 Windows 可执行程序的名称,而不是 Python 命令。 因此,您可以通过在“C:\&gt;”Windows 命令提示符处输入相同的命令来运行 TensorBoard。

    【讨论】:

      猜你喜欢
      • 2022-12-02
      • 2013-04-09
      • 1970-01-01
      • 2020-11-07
      • 2017-01-09
      • 2017-06-14
      • 2023-03-11
      相关资源
      最近更新 更多