2016-06-09 86 views
1

最近,我在Jupyter/IPython筆記本中使用TensorFlow中的InteractiveSession出現錯誤。問題是如此直截了當地重建,我的整個代碼是:使用TensorFlow和Jupyter實例化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> 

使圖形呼叫的作品,但我無法解釋這個錯誤或擺脫的。

+0

您正在使用哪個版本的TensorFlow?最近調整了交互式會話析構函數代碼,並且我還沒有能夠用最新版本重新創建它。 – mrry

+0

我正在使用版本v0.8.0 –

回答

1

此錯誤消息是由TensorFlow版本0.8和更早版本中的錯誤引起的。在Python垃圾收集器刪除舊的tf.InteractiveSession之前,會觸發該錯誤。在TensorFlow 0.9版中是fixed,所以升級到最新版本應該可以解決問題。

+0

謝謝!我會更新。 –

相關問題