Fix error caused in MonitoredSession.close() (#12229)
* Fix error caused in MonitoredSession.close()
This fix tries to address the error raised in 12224:
```
>>> import tensorflow as tf
>>> with tf.train.MonitoredTrainingSession() as sess:
... sess.close()
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 534, in __exit__
self._close_internal(exception_type)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 569, in _close_internal
self._sess.close()
AttributeError: 'NoneType' object has no attribute 'close'
```
The error was caused by double call on `_internal_close()`.
This fix fixes the issue.
This fix fixes 12224
Signed-off-by:
Yong Tang <yong.tang.github@outlook.com>
* Add a test case for in MonitoredSession.close() and with statement
This test case covers 12224.
Signed-off-by:
Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment