Skip to content

Commit af41a02

Browse files
caisqtensorflower-gardener
authored andcommitted
tfdbg: Fix python3 breakage in grpc debug tests caused by bytes-type plugin_data content
PiperOrigin-RevId: 167812508
1 parent 92570f8 commit af41a02

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

tensorflow/python/debug/lib/grpc_debug_server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from tensorflow.python.debug.lib import debug_graphs
3333
from tensorflow.python.debug.lib import debug_service_pb2_grpc
3434
from tensorflow.python.platform import tf_logging as logging
35+
from tensorflow.python.util import compat
3536

3637
DebugWatch = collections.namedtuple("DebugWatch",
3738
["node_name", "output_slot", "debug_op"])
@@ -219,7 +220,8 @@ def _process_tensor_event_in_chunks(self, event, tensor_chunks):
219220
"""
220221

221222
value = event.summary.value[0]
222-
debugger_plugin_metadata = json.loads(value.metadata.plugin_data.content)
223+
debugger_plugin_metadata = json.loads(
224+
compat.as_text(value.metadata.plugin_data.content))
223225
device_name = debugger_plugin_metadata["device"]
224226
num_chunks = debugger_plugin_metadata["numChunks"]
225227
chunk_index = debugger_plugin_metadata["chunkIndex"]

tensorflow/python/debug/lib/grpc_debug_test_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from tensorflow.python.framework import constant_op
4242
from tensorflow.python.framework import errors
4343
from tensorflow.python.ops import variables
44+
from tensorflow.python.util import compat
4445

4546

4647
def _get_dump_file_path(dump_root, device_name, debug_node_name):
@@ -198,7 +199,7 @@ def _write_value_event(self, event):
198199
if not summary_metadata.plugin_data:
199200
raise ValueError("The value lacks plugin data.")
200201
try:
201-
content = json.loads(summary_metadata.plugin_data.content)
202+
content = json.loads(compat.as_text(summary_metadata.plugin_data.content))
202203
except ValueError as err:
203204
raise ValueError("Could not parse content into JSON: %r, %r" % (content,
204205
err))

0 commit comments

Comments
 (0)