Python tensorflow.python.pywrap_tensorflow.TF_DeleteDeprecatedSession() Examples
The following are 5
code examples of tensorflow.python.pywrap_tensorflow.TF_DeleteDeprecatedSession().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.pywrap_tensorflow
, or try the search function
.
Example #1
Source File: session.py From lambda-packs with MIT License | 6 votes |
def __del__(self): # cleanly ignore all exceptions try: self.close() except Exception: # pylint: disable=broad-except pass if self._session is not None: # We create `status` outside the `try` block because at shutdown # `tf_session` may have been garbage collected, and the creation # of a status object may fail. In that case, we prefer to ignore # the failure and silently leak the session object, since the # program is about to terminate. status = None try: status = tf_session.TF_NewStatus() tf_session.TF_DeleteDeprecatedSession(self._session, status) except AttributeError: # 'NoneType' object has no attribute 'TF_NewStatus' pass finally: if status is not None: tf_session.TF_DeleteStatus(status) self._session = None
Example #2
Source File: session.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def __del__(self): # cleanly ignore all exceptions try: self.close() except Exception: # pylint: disable=broad-except pass if self._session is not None: try: status = c_api_util.ScopedTFStatus() if self._created_with_new_api: tf_session.TF_DeleteSession(self._session, status) else: tf_session.TF_DeleteDeprecatedSession(self._session, status) except AttributeError: # At shutdown, `c_api_util` or `tf_session` may have been garbage # collected, causing the above method calls to fail. In this case, # silently leak since the program is about to terminate anyway. pass self._session = None
Example #3
Source File: session.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def __del__(self): # cleanly ignore all exceptions try: self.close() except Exception: # pylint: disable=broad-except pass if self._session is not None: try: status = tf_session.TF_NewStatus() tf_session.TF_DeleteDeprecatedSession(self._session, status) finally: tf_session.TF_DeleteStatus(status) self._session = None
Example #4
Source File: session.py From deep_image_model with Apache License 2.0 | 5 votes |
def __del__(self): # cleanly ignore all exceptions try: self.close() except Exception: # pylint: disable=broad-except pass if self._session is not None: try: status = tf_session.TF_NewStatus() tf_session.TF_DeleteDeprecatedSession(self._session, status) finally: tf_session.TF_DeleteStatus(status) self._session = None
Example #5
Source File: session.py From keras-lambda with MIT License | 5 votes |
def __del__(self): # cleanly ignore all exceptions try: self.close() except Exception: # pylint: disable=broad-except pass if self._session is not None: try: status = tf_session.TF_NewStatus() tf_session.TF_DeleteDeprecatedSession(self._session, status) finally: tf_session.TF_DeleteStatus(status) self._session = None