【发布时间】:2016-06-09 18:07:46
【问题描述】:
最近,我在 Jupyter / IPython 笔记本中使用 TensorFlow 中的 InteractiveSession 时遇到了错误。这个问题很容易重新创建,我的整个代码是:
import tensorflow as tf
sess = tf.InteractiveSession()
sess.graph
输出是:
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.InteractiveSession object at 0x11a4e89b0>>
Traceback (most recent call last):
File "/Users/.../anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 140, in __del__
self.close()
File "/Users/.../anaconda/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in close
self._default_session.__exit__(None, None, None)
File "/Users/brad/anaconda/lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "/Users/.../anaconda/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3215, in get_controller
assert self.stack[-1] is default
AssertionError:
Out[3]:
<tensorflow.python.framework.ops.Graph at 0x10685dc50>
所以图形调用有效,但我无法解释或消除此错误。
【问题讨论】:
-
您使用的是哪个版本的 TensorFlow?最近对交互式会话析构函数代码进行了调整,我无法使用最新版本重新创建它。
-
我使用的是 v0.8.0 版本
标签: python ipython tensorflow jupyter