diff options
Diffstat (limited to 'tensorflow/python/keras/callbacks_test.py')
-rw-r--r-- | tensorflow/python/keras/callbacks_test.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tensorflow/python/keras/callbacks_test.py b/tensorflow/python/keras/callbacks_test.py index 7675a6586f..b6fae19823 100644 --- a/tensorflow/python/keras/callbacks_test.py +++ b/tensorflow/python/keras/callbacks_test.py @@ -63,7 +63,7 @@ class KerasCallbacksTest(test.TestCase): if h5py is None: return # Skip test if models cannot be saved. - with self.test_session(): + with self.cached_session(): np.random.seed(1337) temp_dir = self.get_temp_dir() @@ -226,7 +226,7 @@ class KerasCallbacksTest(test.TestCase): mode='unknown') def test_EarlyStopping(self): - with self.test_session(): + with self.cached_session(): np.random.seed(123) (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -265,7 +265,7 @@ class KerasCallbacksTest(test.TestCase): verbose=0) def test_EarlyStopping_reuse(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) patience = 3 data = np.random.random((100, 1)) @@ -287,7 +287,7 @@ class KerasCallbacksTest(test.TestCase): assert len(hist.epoch) >= patience def test_EarlyStopping_with_baseline(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) baseline = 0.5 (data, labels), _ = testing_utils.get_test_data( @@ -321,7 +321,7 @@ class KerasCallbacksTest(test.TestCase): monitor.on_epoch_end(0, logs={'loss': 0.}) def test_LearningRateScheduler(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -368,7 +368,7 @@ class KerasCallbacksTest(test.TestCase): model.optimizer.lr)) - 0.01 / 4) < keras.backend.epsilon() def test_ReduceLROnPlateau(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -470,7 +470,7 @@ class KerasCallbacksTest(test.TestCase): self.assertEqual(reduce_on_plateau.min_delta, 1e-13) def test_CSVLogger(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) temp_dir = self.get_temp_dir() self.addCleanup(shutil.rmtree, temp_dir, ignore_errors=True) @@ -549,7 +549,7 @@ class KerasCallbacksTest(test.TestCase): tmpdir = self.get_temp_dir() self.addCleanup(shutil.rmtree, tmpdir, ignore_errors=True) - with self.test_session(): + with self.cached_session(): fp = os.path.join(tmpdir, 'test.csv') (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -601,7 +601,7 @@ class KerasCallbacksTest(test.TestCase): assert 'nan' in values[-1], 'The last epoch was not logged.' def test_TerminateOnNaN(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -666,7 +666,7 @@ class KerasCallbacksTest(test.TestCase): i %= max_batch_index # case: Sequential - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add( keras.layers.Dense( @@ -743,7 +743,7 @@ class KerasCallbacksTest(test.TestCase): tmpdir = self.get_temp_dir() self.addCleanup(shutil.rmtree, tmpdir, ignore_errors=True) - with self.test_session(): + with self.cached_session(): filepath = os.path.join(tmpdir, 'logs') (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( @@ -815,7 +815,7 @@ class KerasCallbacksTest(test.TestCase): tmpdir = self.get_temp_dir() self.addCleanup(shutil.rmtree, tmpdir, ignore_errors=True) - with self.test_session(): + with self.cached_session(): filepath = os.path.join(tmpdir, 'logs') (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( @@ -925,7 +925,7 @@ class KerasCallbacksTest(test.TestCase): y_test = keras.utils.to_categorical(y_test) y_train = keras.utils.to_categorical(y_train) - with self.test_session(): + with self.cached_session(): model = keras.models.Sequential() model.add( keras.layers.Dense( @@ -969,7 +969,7 @@ class KerasCallbacksTest(test.TestCase): while True: yield x, y - with self.test_session(): + with self.cached_session(): model = testing_utils.get_small_sequential_mlp( num_hidden=10, num_classes=10, input_dim=100) model.compile( @@ -1011,7 +1011,7 @@ class KerasCallbacksTest(test.TestCase): os.name == 'nt', 'use_multiprocessing=True does not work on windows properly.') def test_LambdaCallback(self): - with self.test_session(): + with self.cached_session(): np.random.seed(1337) (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, @@ -1055,7 +1055,7 @@ class KerasCallbacksTest(test.TestCase): assert not t.is_alive() def test_TensorBoard_with_ReduceLROnPlateau(self): - with self.test_session(): + with self.cached_session(): temp_dir = self.get_temp_dir() self.addCleanup(shutil.rmtree, temp_dir, ignore_errors=True) @@ -1194,7 +1194,7 @@ class KerasCallbacksTest(test.TestCase): def test_RemoteMonitorWithJsonPayload(self): if requests is None: self.skipTest('`requests` required to run this test') - with self.test_session(): + with self.cached_session(): (x_train, y_train), (x_test, y_test) = testing_utils.get_test_data( train_samples=TRAIN_SAMPLES, test_samples=TEST_SAMPLES, |