diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-10 14:36:26 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-10 14:49:41 -0700 |
commit | 890e16594a005fe703a5556530b0dc3e6527fa47 (patch) | |
tree | 99140efb13f392ae13a58f08c08754c61bf66f13 /tensorflow/contrib/saved_model | |
parent | 132babebf5b1026cb33cad7c4eb7e03810c2acdf (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: 212336321
Diffstat (limited to 'tensorflow/contrib/saved_model')
-rw-r--r-- | tensorflow/contrib/saved_model/python/saved_model/keras_saved_model_test.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tensorflow/contrib/saved_model/python/saved_model/keras_saved_model_test.py b/tensorflow/contrib/saved_model/python/saved_model/keras_saved_model_test.py index 8a0dbef788..12dd72a95b 100644 --- a/tensorflow/contrib/saved_model/python/saved_model/keras_saved_model_test.py +++ b/tensorflow/contrib/saved_model/python/saved_model/keras_saved_model_test.py @@ -50,7 +50,7 @@ class TestModelSavingandLoading(test.TestCase): return os.path.join(temp_dir, dirname) def test_saving_sequential_model(self): - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add(keras.layers.Dense(2, input_shape=(3,))) model.add(keras.layers.RepeatVector(3)) @@ -75,7 +75,7 @@ class TestModelSavingandLoading(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_saving_sequential_model_without_compile(self): - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add(keras.layers.Dense(2, input_shape=(3,))) model.add(keras.layers.RepeatVector(3)) @@ -92,7 +92,7 @@ class TestModelSavingandLoading(test.TestCase): self.assertAllClose(ref_y, y, atol=1e-05) def test_saving_functional_model(self): - with self.test_session(): + with self.cached_session(): inputs = keras.layers.Input(shape=(3,)) x = keras.layers.Dense(2)(inputs) output = keras.layers.Dense(3)(x) @@ -117,7 +117,7 @@ class TestModelSavingandLoading(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_saving_functional_model_without_compile(self): - with self.test_session(): + with self.cached_session(): inputs = keras.layers.Input(shape=(3,)) x = keras.layers.Dense(2)(inputs) output = keras.layers.Dense(3)(x) @@ -138,7 +138,7 @@ class TestModelSavingandLoading(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_saving_with_tf_optimizer(self): - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add(keras.layers.Dense(2, input_shape=(3,))) model.add(keras.layers.Dense(3)) |