diff options
author | 2018-08-21 19:24:19 -0700 | |
---|---|---|
committer | 2018-08-21 19:27:54 -0700 | |
commit | 496023e9dc84a076caeb2e5e8e13b6a3d819ad6d (patch) | |
tree | 9776c9865f7b98a15817bc6be4c2b683323a67b1 /tensorflow/contrib/autograph | |
parent | 361a82d73a50a800510674b3aaa20e4845e56434 (diff) |
Move from deprecated self.test_session() to self.cached_session().
self.test_session() has been deprecated in 9962eb5e84b15e309410071b06c2ed2d6148ed44 as its name confuses readers of the test. Moving to cached_session() instead which is more explicit about:
* the fact that the session may be reused.
* the session is not closed even when doing a "with self.test_session()" statement.
PiperOrigin-RevId: 209701635
Diffstat (limited to 'tensorflow/contrib/autograph')
-rw-r--r-- | tensorflow/contrib/autograph/examples/integration_tests/errors_test.py | 4 | ||||
-rw-r--r-- | tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py b/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py index f4b9159942..04a968be10 100644 --- a/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py +++ b/tensorflow/contrib/autograph/examples/integration_tests/errors_test.py @@ -97,7 +97,7 @@ class ErrorsTest(tf.test.TestCase): compiled_fn = ag.to_graph(test_fn) with self.assertRaises(ag.TfRuntimeError) as error: - with self.test_session() as sess: + with self.cached_session() as sess: x = compiled_fn(tf.constant([4, 8])) with ag.improved_errors(compiled_fn): sess.run(x) @@ -144,7 +144,7 @@ class ErrorsTest(tf.test.TestCase): # frame with "g" as the function name but because we don't yet add # try/except blocks to inner functions the name is "tf__g". with self.assertRaises(ag.TfRuntimeError) as error: - with self.test_session() as sess: + with self.cached_session() as sess: x = compiled_fn(tf.constant([4, 8])) with ag.improved_errors(compiled_fn): sess.run(x) diff --git a/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py b/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py index 680b6dbaf0..904246afb7 100644 --- a/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py +++ b/tensorflow/contrib/autograph/examples/integration_tests/list_literals_test.py @@ -33,7 +33,7 @@ class ListLiteralsTest(tf.test.TestCase): converted = ag.to_graph(list_used_as_tuple) result = converted() - with self.test_session() as sess: + with self.cached_session() as sess: self.assertAllEqual(sess.run(result), [1, 2, 3]) |