From 85f3821cf8c4cf8354e2aff6e8a4b7c1c5f2fd88 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 31 Dec 2018 00:39:14 +0000 Subject: [PATCH 1/2] Replace deprecated test_session with cached_session in quantile_ops_test This fix replace deprecated test_session with cached_session in quantile_ops_test.py to remove warnings during tests Signed-off-by: Yong Tang --- .../python/kernel_tests/boosted_trees/quantile_ops_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py index 37a60fa0e38..12eb58536a7 100644 --- a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py +++ b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py @@ -145,7 +145,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): save_dir = os.path.join(self.get_temp_dir(), "save_restore") save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash") - with self.test_session() as sess: + with self.cached_session() as sess: accumulator = boosted_trees_ops.QuantileAccumulator( num_streams=2, num_quantiles=3, epsilon=self.eps, name="q0") @@ -177,7 +177,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): save_dir = os.path.join(self.get_temp_dir(), "save_restore") save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash") - with self.test_session() as sess: + with self.cached_session() as sess: accumulator = boosted_trees_ops.QuantileAccumulator( num_streams=2, num_quantiles=3, epsilon=self.eps, name="q0") From 1f6a9fc270bd356e817f208b9386732f03824c65 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Mon, 31 Dec 2018 00:40:43 +0000 Subject: [PATCH 2/2] Fix test_session warnings during tests by replacing it with session() Signed-off-by: Yong Tang --- .../python/kernel_tests/boosted_trees/quantile_ops_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py index 12eb58536a7..0315456447d 100644 --- a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py +++ b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py @@ -164,7 +164,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.assertAllClose(self._feature_1_boundaries, buckets[1].eval()) save.save(sess, save_path) - with self.test_session(graph=ops.Graph()) as sess: + with self.session(graph=ops.Graph()) as sess: accumulator = boosted_trees_ops.QuantileAccumulator( num_streams=2, num_quantiles=3, epsilon=self.eps, name="q0") save = saver.Saver() @@ -195,7 +195,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.assertAllClose(self._feature_0_boundaries, buckets[0].eval()) self.assertAllClose(self._feature_1_boundaries, buckets[1].eval()) - with self.test_session(graph=ops.Graph()) as sess: + with self.session(graph=ops.Graph()) as sess: accumulator = boosted_trees_ops.QuantileAccumulator( num_streams=2, num_quantiles=3, epsilon=self.eps, name="q0") save = saver.Saver()