diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-17 13:24:29 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-17 13:34:57 -0700 |
commit | a768624f1d0ae3629caf5b9784b4b6911b881c18 (patch) | |
tree | f7581648c47b4ad95d10099f4485e5f41463f767 /tensorflow/contrib/tensor_forest | |
parent | d7b4bf68dc80f1abf90bd6b857f079157028a861 (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: 213326581
Diffstat (limited to 'tensorflow/contrib/tensor_forest')
-rw-r--r-- | tensorflow/contrib/tensor_forest/client/eval_metrics_test.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/contrib/tensor_forest/client/eval_metrics_test.py b/tensorflow/contrib/tensor_forest/client/eval_metrics_test.py index aa30919167..d49928e3f1 100644 --- a/tensorflow/contrib/tensor_forest/client/eval_metrics_test.py +++ b/tensorflow/contrib/tensor_forest/client/eval_metrics_test.py @@ -32,7 +32,7 @@ class EvalMetricsTest(test_util.TensorFlowTestCase): [0.9, 0.8, 0.2], [0.6, 0.4, 0.8]]) targets = constant_op.constant([[0], [2], [1], [1]]) in_top_2_op, update_op = top_2_fn(probabilities, targets) - with self.test_session(): + with self.cached_session(): # initializes internal accuracy vars variables.local_variables_initializer().run() # need to call in order to run the in_top_2_op internal operations because @@ -49,7 +49,7 @@ class EvalMetricsTest(test_util.TensorFlowTestCase): [0.3, 0.6, 0.9, 0.4, 0.8, 0.6]]) targets = constant_op.constant([3, 0, 2, 5, 1]) in_top_3_op, update_op = top_3_fn(probabilities, targets) - with self.test_session(): + with self.cached_session(): # initializes internal accuracy vars variables.local_variables_initializer().run() # need to call in order to run the in_top_3_op internal operations because @@ -61,7 +61,7 @@ class EvalMetricsTest(test_util.TensorFlowTestCase): predictions = constant_op.constant([0, 1, 3, 6, 5, 2, 7, 6, 4, 9]) targets = constant_op.constant([0, 1, 4, 6, 5, 1, 7, 5, 4, 8]) accuracy_op, update_op = eval_metrics._accuracy(predictions, targets) - with self.test_session(): + with self.cached_session(): variables.local_variables_initializer().run() # need to call in order to run the accuracy_op internal operations because # it is a streaming function @@ -74,7 +74,7 @@ class EvalMetricsTest(test_util.TensorFlowTestCase): targets = constant_op.constant( [1.0, 4.3, 2.6, 0.5, 1.1, 0.7, 5.1, 3.4, 1.8]) r2_op, update_op = eval_metrics._r2(scores, targets) - with self.test_session(): + with self.cached_session(): # initializes internal accuracy vars variables.local_variables_initializer().run() # need to call in order to run the r2_op internal operations because |