diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-24 11:28:07 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-24 11:37:28 -0700 |
commit | 28eeda839f124cf5ba648576e86214b38141e4ab (patch) | |
tree | ab662878c5af9b531fab0592148c716740d1c750 /tensorflow/python/training | |
parent | 5fbb064ba1e78bb28f7adbe92e6583c3b2bdfda7 (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: 214300210
Diffstat (limited to 'tensorflow/python/training')
-rw-r--r-- | tensorflow/python/training/ftrl_test.py | 4 | ||||
-rw-r--r-- | tensorflow/python/training/learning_rate_decay_v2_test.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/python/training/ftrl_test.py b/tensorflow/python/training/ftrl_test.py index 09d6fe36d3..15c50bc878 100644 --- a/tensorflow/python/training/ftrl_test.py +++ b/tensorflow/python/training/ftrl_test.py @@ -218,7 +218,7 @@ class FtrlOptimizerTest(test.TestCase): def testFtrlWithL1_L2_L2ShrinkageSparse(self): """Tests the new FTRL op with support for l2 shrinkage on sparse grads.""" for dtype in [dtypes.half, dtypes.float32]: - with self.test_session() as sess: + with self.cached_session() as sess: var0 = variables.Variable([[1.0], [2.0]], dtype=dtype) var1 = variables.Variable([[4.0], [3.0]], dtype=dtype) grads0 = ops.IndexedSlices( @@ -252,7 +252,7 @@ class FtrlOptimizerTest(test.TestCase): def testFtrlWithL2ShrinkageDoesNotChangeLrSchedule(self): """Verifies that l2 shrinkage in FTRL does not change lr schedule.""" for dtype in [dtypes.half, dtypes.float32]: - with self.test_session() as sess: + with self.cached_session() as sess: var0 = variables.Variable([1.0, 2.0], dtype=dtype) var1 = variables.Variable([1.0, 2.0], dtype=dtype) grads0 = constant_op.constant([0.1, 0.2], dtype=dtype) diff --git a/tensorflow/python/training/learning_rate_decay_v2_test.py b/tensorflow/python/training/learning_rate_decay_v2_test.py index 0f2d60dafc..b2ac93f06f 100644 --- a/tensorflow/python/training/learning_rate_decay_v2_test.py +++ b/tensorflow/python/training/learning_rate_decay_v2_test.py @@ -62,7 +62,7 @@ class LRDecayTestV2(test_util.TensorFlowTestCase): self.assertAllClose(self.evaluate(decayed_lr()), expected, 1e-6) def testVariables(self): - with self.test_session(): + with self.cached_session(): step = variables.Variable(1) assign_1 = step.assign(1) assign_2 = step.assign(2) |