Reputation: 678
Recently I've been getting an error using the InteractiveSession in TensorFlow in my Jupyter / IPython notebook. The problem is so straight forward to recreate, my entire code is:
import tensorflow as tf
sess = tf.InteractiveSession()
sess.graph
And the output is:
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>
So the graph call works, but I can't interpret this error or get rid of it.
Upvotes: 1
Views: 1388
Reputation: 126184
This error message is caused by a bug in TensorFlow versions 0.8 and earlier. The bug is triggered when a new tf.InteractiveSession
is created before an old one is deleted by the Python garbage collector. It was fixed in TensorFlow version 0.9, so upgrading to the latest version should resolve the issue.
Upvotes: 1