diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-22 15:16:35 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-22 15:45:28 -0700 |
commit | 44e55c111fc9240cf777fa771d0128a1f8d64e0b (patch) | |
tree | 7e45901de376c872d8221f8a31b0570ce3437bed /tensorflow/python/keras/integration_test.py | |
parent | 8b3e40586af915c4d59cd5233c8f937659a15d37 (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: 209839057
Diffstat (limited to 'tensorflow/python/keras/integration_test.py')
-rw-r--r-- | tensorflow/python/keras/integration_test.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tensorflow/python/keras/integration_test.py b/tensorflow/python/keras/integration_test.py index a103b9fbf2..3c0f73b1c3 100644 --- a/tensorflow/python/keras/integration_test.py +++ b/tensorflow/python/keras/integration_test.py @@ -35,7 +35,7 @@ class KerasIntegrationTest(test.TestCase): self.assertTrue(keras.__version__.endswith('-tf')) def test_vector_classification_sequential(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -60,7 +60,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_vector_classification_functional(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -84,7 +84,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_temporal_classification_sequential(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -106,7 +106,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_temporal_classification_sequential_tf_rnn(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -130,7 +130,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_image_classification_sequential(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -164,7 +164,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_video_classification_functional(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -194,7 +194,7 @@ class KerasIntegrationTest(test.TestCase): def test_vector_classification_shared_sequential(self): # Test that Sequential models that feature internal updates # and internal losses can be shared. - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -228,7 +228,7 @@ class KerasIntegrationTest(test.TestCase): def test_vector_classification_shared_model(self): # Test that functional models that feature internal updates # and internal losses can be shared. - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -259,14 +259,14 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_embedding_with_clipnorm(self): - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add(keras.layers.Embedding(input_dim=1, output_dim=1)) model.compile(optimizer=keras.optimizers.SGD(clipnorm=0.1), loss='mse') model.fit(np.array([[0]]), np.array([[[0.5]]]), epochs=1) def test_using_tf_layers_in_keras_sequential_model(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, @@ -289,7 +289,7 @@ class KerasIntegrationTest(test.TestCase): self.assertGreater(history.history['val_acc'][-1], 0.7) def test_using_tf_layers_in_keras_functional_model(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), _ = testing_utils.get_test_data( train_samples=100, |