Spyder 附加 Tensorboard 摘要文件

Spyder appends Tensorboard summary files

当我从控制台 运行 我的 python 代码时,一切正常:我每次都得到一个新的 tensorboard 文件(626 字节),我可以使用 Tensorboard 服务查找它。

但是,当我 运行 来自 Spyder IDE 的这段代码时,在每个 运行 之后都会有一个包含来自 all[=20= 的数据的新文件] 自 Spyder 启动以来的 运行s。在 Spyder 中执行 10 运行s 之后,即使我关闭了 tensorboard 服务器并删除了带有日志的目录,在第 11 运行 之后会有一个大约 6K 大小的新文件,包含所有以前的 运行s.

import tensorflow as tf
a = tf.constant(2,name ='a')
b = tf.constant(3,name = 'b')
x = tf.add(a, b)
with tf.Session() as sess:
# add this line to use TensorBoard.
    writer = tf.summary.FileWriter('./graphs', sess.graph)

    print (sess.run(x))

    writer.close() # close the writer when you’re done using i

Spyder重启后整个故事重新开始,第一个运行产生正确的结果,而第二个已经包含其前身数据。

Spyder IDE 做一些缓存或什么?

好的,我找到了我自己的问题的答案。 Spyder中有一个设置:Tools -> Preferences -> 运行 -> 'Clear all variables before execution'

(也在 运行 -> 每个文件的配置... -> 'Clear all variables before execution')

详情:https://github.com/spyder-ide/spyder/issues/2563