aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/proto
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-21 19:53:43 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-21 20:00:41 -0700
commit47c0bda0e7f736a9328aaf76aba7c8006e24556f (patch)
treead2a6ab71adddc0d07c7f306c270122937b6a5b0 /tensorflow/contrib/proto
parent1ab795b54274a26a92690f36eff65674fb500f91 (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: 209703607
Diffstat (limited to 'tensorflow/contrib/proto')
-rw-r--r--tensorflow/contrib/proto/python/kernel_tests/decode_proto_op_test_base.py4
-rw-r--r--tensorflow/contrib/proto/python/kernel_tests/descriptor_source_test_base.py2
-rw-r--r--tensorflow/contrib/proto/python/kernel_tests/encode_proto_op_test_base.py10
3 files changed, 8 insertions, 8 deletions
diff --git a/tensorflow/contrib/proto/python/kernel_tests/decode_proto_op_test_base.py b/tensorflow/contrib/proto/python/kernel_tests/decode_proto_op_test_base.py
index e3570e38a3..17b69c7b35 100644
--- a/tensorflow/contrib/proto/python/kernel_tests/decode_proto_op_test_base.py
+++ b/tensorflow/contrib/proto/python/kernel_tests/decode_proto_op_test_base.py
@@ -170,7 +170,7 @@ class DecodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
field_names = [f.name for f in fields]
output_types = [f.dtype for f in fields]
- with self.test_session() as sess:
+ with self.cached_session() as sess:
sizes, vtensor = self._decode_module.decode_proto(
batch,
message_type=message_type,
@@ -290,7 +290,7 @@ class DecodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
field_names = ['sizes']
field_types = [dtypes.int32]
- with self.test_session() as sess:
+ with self.cached_session() as sess:
ctensor, vtensor = self._decode_module.decode_proto(
batch,
message_type=msg_type,
diff --git a/tensorflow/contrib/proto/python/kernel_tests/descriptor_source_test_base.py b/tensorflow/contrib/proto/python/kernel_tests/descriptor_source_test_base.py
index 9a1c04af32..7e9b355c69 100644
--- a/tensorflow/contrib/proto/python/kernel_tests/descriptor_source_test_base.py
+++ b/tensorflow/contrib/proto/python/kernel_tests/descriptor_source_test_base.py
@@ -137,7 +137,7 @@ class DescriptorSourceTestBase(test.TestCase):
field_names = ['values', 'shapes', 'sizes', 'fields']
tensor_types = [dtypes.string, dtypes.int32, dtypes.int32, dtypes.string]
- with self.test_session() as sess:
+ with self.cached_session() as sess:
sizes, field_tensors = self._decode_module.decode_proto(
in_bufs,
message_type=message_type,
diff --git a/tensorflow/contrib/proto/python/kernel_tests/encode_proto_op_test_base.py b/tensorflow/contrib/proto/python/kernel_tests/encode_proto_op_test_base.py
index 07dfb924d3..01b3ccc7fd 100644
--- a/tensorflow/contrib/proto/python/kernel_tests/encode_proto_op_test_base.py
+++ b/tensorflow/contrib/proto/python/kernel_tests/encode_proto_op_test_base.py
@@ -55,7 +55,7 @@ class EncodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
def testBadInputs(self):
# Invalid field name
- with self.test_session():
+ with self.cached_session():
with self.assertRaisesOpError('Unknown field: non_existent_field'):
self._encode_module.encode_proto(
sizes=[[1]],
@@ -64,7 +64,7 @@ class EncodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
field_names=['non_existent_field']).eval()
# Incorrect types.
- with self.test_session():
+ with self.cached_session():
with self.assertRaisesOpError(
'Incompatible type for field double_value.'):
self._encode_module.encode_proto(
@@ -74,7 +74,7 @@ class EncodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
field_names=['double_value']).eval()
# Incorrect shapes of sizes.
- with self.test_session():
+ with self.cached_session():
with self.assertRaisesOpError(
r'sizes should be batch_size \+ \[len\(field_names\)\]'):
sizes = array_ops.placeholder(dtypes.int32)
@@ -89,7 +89,7 @@ class EncodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
})
# Inconsistent shapes of values.
- with self.test_session():
+ with self.cached_session():
with self.assertRaisesOpError(
'Values must match up to the last dimension'):
sizes = array_ops.placeholder(dtypes.int32)
@@ -109,7 +109,7 @@ class EncodeProtoOpTestBase(test_base.ProtoOpTestBase, parameterized.TestCase):
field_names = [f.name for f in fields]
out_types = [f.dtype for f in fields]
- with self.test_session() as sess:
+ with self.cached_session() as sess:
sizes, field_tensors = self._decode_module.decode_proto(
in_bufs,
message_type=message_type,