Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate test_session() and introduce instead session() and cached_s…
…ession(). Implicitly, test_session(graph=None,...) will by default cache the session and thus the object will not be deleted if used in a with statement: with self.test_session(): # Some code # Some other code where by default we would expect that the session is closed by now. The fact that the session is not closed when we exit the with scope has caused surprise to users and created hard to diagnose bugs. To keep backward compatibility, we are deprecating this function and introducing a new one called cached_session that will by default always cache the session (even when graph is not None) and a new function where session will always be closed. Note that the behavior of test_session has slightly changed as it will always set the graph and session as global default (with as_default). The documentation of test_session has also changed as the documentation was not matching the previous behavior of test_session. PiperOrigin-RevId: 209511997
- Loading branch information