diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-21 00:02:49 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-21 00:07:39 -0700 |
commit | 2952f5134905af795ba90ae1eb97e39091ba9843 (patch) | |
tree | f73bc5cd0342d9449114bd933863c2aa55610aa2 /tensorflow/python/keras | |
parent | cf047f7755f3400ee128db2571042091fe9f8314 (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: 213944355
Diffstat (limited to 'tensorflow/python/keras')
-rw-r--r-- | tensorflow/python/keras/utils/multi_gpu_utils_test.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/python/keras/utils/multi_gpu_utils_test.py b/tensorflow/python/keras/utils/multi_gpu_utils_test.py index c7e94998b4..d6016ed711 100644 --- a/tensorflow/python/keras/utils/multi_gpu_utils_test.py +++ b/tensorflow/python/keras/utils/multi_gpu_utils_test.py @@ -48,7 +48,7 @@ class TestMultiGPUModel(test.TestCase): if not check_if_compatible_devices(gpus=gpus): return - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add(keras.layers.Dense(hidden_dim, input_shape=(input_dim,))) @@ -78,7 +78,7 @@ class TestMultiGPUModel(test.TestCase): if not check_if_compatible_devices(gpus=gpus): return - with self.test_session(): + with self.cached_session(): input_a = keras.Input((input_dim_a,)) input_b = keras.Input((input_dim_b,)) a = keras.layers.Dense(hidden_dim)(input_a) @@ -105,7 +105,7 @@ class TestMultiGPUModel(test.TestCase): if not check_if_compatible_devices(gpus=2): return - with self.test_session(): + with self.cached_session(): input_shape = (1000, 10) model = keras.models.Sequential() model.add(keras.layers.Dense(10, @@ -144,7 +144,7 @@ class TestMultiGPUModel(test.TestCase): if not check_if_compatible_devices(gpus=gpus): return - with self.test_session(): + with self.cached_session(): input_shape = (num_samples,) + shape x_train = np.random.randint(0, 255, input_shape) y_train = np.random.randint(0, num_classes, (input_shape[0],)) |