aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/distribute
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-01 08:21:58 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-01 08:26:34 -0700
commit9a2f872acd0c38d74d60e4f67701241aa1a26419 (patch)
treedb52cf8c0a93f458f50e1a0449a57a739b0d0904 /tensorflow/contrib/distribute
parenteef9a3e816932b7c34f426d00d7df53c91130402 (diff)
Move from deprecated self.test_session() to self.cached_session() or self.session().
* Move from self.test_session(graph=ops.Graph(), ...) to self.session(...) (semantically equivalent). * Move from self.test_session() to self.cached_session(config=self.config) when run_in_graph_and_eager_modes(config=config) is set to be consistent between eager and non eager modes. 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: 215216964
Diffstat (limited to 'tensorflow/contrib/distribute')
-rw-r--r--tensorflow/contrib/distribute/python/values_test.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/contrib/distribute/python/values_test.py b/tensorflow/contrib/distribute/python/values_test.py
index ae3e134333..121d2fbb3f 100644
--- a/tensorflow/contrib/distribute/python/values_test.py
+++ b/tensorflow/contrib/distribute/python/values_test.py
@@ -641,7 +641,7 @@ class MirroredVariableTest(test.TestCase):
if context.num_gpus() < 1 and context.executing_eagerly():
self.skipTest("A GPU is not available for this test in eager mode.")
- with self.test_session() as sess:
+ with self.cached_session(config=self.config) as sess:
v, devices, mirrored = _make_mirrored()
# Overwrite the initial values.
@@ -744,7 +744,7 @@ class MirroredVariableTest(test.TestCase):
if context.num_gpus() < 1 or context.executing_eagerly():
self.skipTest("A GPU is not available for this test or it's eager mode.")
- with self.test_session(
+ with self.session(
graph=ops.Graph()) as sess, mirrored_strategy.MirroredStrategy(
["/device:GPU:0"]).scope():
with ops.device("/device:GPU:0"):
@@ -827,7 +827,7 @@ class TowerLocalVariableTest(test.TestCase):
if context.num_gpus() < 1 and context.executing_eagerly():
self.skipTest("A GPU is not available for this test in eager mode.")
- with self.test_session() as sess:
+ with self.cached_session(config=self.config) as sess:
v, tower_local = _make_tower_local(variable_scope.VariableAggregation.SUM)
# Overwrite the initial values.
@@ -850,7 +850,7 @@ class TowerLocalVariableTest(test.TestCase):
if context.num_gpus() < 1 and context.executing_eagerly():
self.skipTest("A GPU is not available for this test in eager mode.")
- with self.test_session() as sess:
+ with self.cached_session(config=self.config) as sess:
v, tower_local = _make_tower_local(
variable_scope.VariableAggregation.MEAN)