diff options
Diffstat (limited to 'tensorflow/examples')
5 files changed, 11 insertions, 11 deletions
diff --git a/tensorflow/examples/adding_an_op/cuda_op_test.py b/tensorflow/examples/adding_an_op/cuda_op_test.py index 07390bc3bf..a9aaa81e3f 100644 --- a/tensorflow/examples/adding_an_op/cuda_op_test.py +++ b/tensorflow/examples/adding_an_op/cuda_op_test.py @@ -26,7 +26,7 @@ class AddOneTest(tf.test.TestCase): def test(self): if tf.test.is_built_with_cuda(): - with self.test_session(): + with self.cached_session(): result = cuda_op.add_one([5, 4, 3, 2, 1]) self.assertAllEqual(result.eval(), [6, 5, 4, 3, 2]) diff --git a/tensorflow/examples/adding_an_op/fact_test.py b/tensorflow/examples/adding_an_op/fact_test.py index f7f17e5180..11163e7ba5 100644 --- a/tensorflow/examples/adding_an_op/fact_test.py +++ b/tensorflow/examples/adding_an_op/fact_test.py @@ -24,7 +24,7 @@ import tensorflow as tf class FactTest(tf.test.TestCase): def test(self): - with self.test_session(): + with self.cached_session(): print(tf.user_ops.my_fact().eval()) diff --git a/tensorflow/examples/adding_an_op/zero_out_1_test.py b/tensorflow/examples/adding_an_op/zero_out_1_test.py index fac486100d..342d3a020c 100644 --- a/tensorflow/examples/adding_an_op/zero_out_1_test.py +++ b/tensorflow/examples/adding_an_op/zero_out_1_test.py @@ -28,7 +28,7 @@ from tensorflow.examples.adding_an_op import zero_out_op_1 class ZeroOut1Test(tf.test.TestCase): def test(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_1.zero_out([5, 4, 3, 2, 1]) self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) diff --git a/tensorflow/examples/adding_an_op/zero_out_2_test.py b/tensorflow/examples/adding_an_op/zero_out_2_test.py index 217bbbcffa..4504597817 100644 --- a/tensorflow/examples/adding_an_op/zero_out_2_test.py +++ b/tensorflow/examples/adding_an_op/zero_out_2_test.py @@ -29,17 +29,17 @@ from tensorflow.examples.adding_an_op import zero_out_op_2 class ZeroOut2Test(tf.test.TestCase): def test(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_2.zero_out([5, 4, 3, 2, 1]) self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) def test_2d(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_2.zero_out([[6, 5, 4], [3, 2, 1]]) self.assertAllEqual(result.eval(), [[6, 0, 0], [0, 0, 0]]) def test_grad(self): - with self.test_session(): + with self.cached_session(): shape = (5,) x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32) y = zero_out_op_2.zero_out(x) @@ -47,7 +47,7 @@ class ZeroOut2Test(tf.test.TestCase): self.assertLess(err, 1e-4) def test_grad_2d(self): - with self.test_session(): + with self.cached_session(): shape = (2, 3) x = tf.constant([[6, 5, 4], [3, 2, 1]], dtype=tf.float32) y = zero_out_op_2.zero_out(x) diff --git a/tensorflow/examples/adding_an_op/zero_out_3_test.py b/tensorflow/examples/adding_an_op/zero_out_3_test.py index 01280caf49..15d62495aa 100644 --- a/tensorflow/examples/adding_an_op/zero_out_3_test.py +++ b/tensorflow/examples/adding_an_op/zero_out_3_test.py @@ -26,23 +26,23 @@ from tensorflow.examples.adding_an_op import zero_out_op_3 class ZeroOut3Test(tf.test.TestCase): def test(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_3.zero_out([5, 4, 3, 2, 1]) self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) def testAttr(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=3) self.assertAllEqual(result.eval(), [0, 0, 0, 2, 0]) def testNegative(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=-1) with self.assertRaisesOpError("Need preserve_index >= 0, got -1"): result.eval() def testLarge(self): - with self.test_session(): + with self.cached_session(): result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=17) with self.assertRaisesOpError("preserve_index out of range"): result.eval() |