Commit bc69a534 by Haichen Shen Committed by Yizhi Liu

Tweak debugger result (#4426)

parent accc7db8
...@@ -204,9 +204,8 @@ class DebugResult(object): ...@@ -204,9 +204,8 @@ class DebugResult(object):
with open(os.path.join(self._dump_path, graph_dump_file_name), 'w') as outfile: with open(os.path.join(self._dump_path, graph_dump_file_name), 'w') as outfile:
json.dump(graph, outfile, indent=4, sort_keys=False) json.dump(graph, outfile, indent=4, sort_keys=False)
def display_debug_result(self, sort_by_time=True): def get_debug_result(self, sort_by_time=True):
"""Displays the debugger result" """Return the debugger result"""
"""
header = ["Node Name", "Ops", "Time(us)", "Time(%)", "Shape", "Inputs", "Outputs"] header = ["Node Name", "Ops", "Time(us)", "Time(%)", "Shape", "Inputs", "Outputs"]
lines = ["---------", "---", "--------", "-------", "-----", "------", "-------"] lines = ["---------", "---", "--------", "-------", "-----", "------", "-------"]
eid = 0 eid = 0
...@@ -244,10 +243,15 @@ class DebugResult(object): ...@@ -244,10 +243,15 @@ class DebugResult(object):
if item_len > max_len: if item_len > max_len:
max_len = item_len max_len = item_len
fmt = fmt + "{:<" + str(max_len + 2) + "}" fmt = fmt + "{:<" + str(max_len + 2) + "}"
print(fmt.format(*header)) log = [fmt.format(*header)]
print(fmt.format(*lines)) log.append(fmt.format(*lines))
for row in data: for row in data:
print(fmt.format(*row)) log.append(fmt.format(*row))
return '\n'.join(log)
def display_debug_result(self, sort_by_time=True):
"""Displays the debugger result"""
print(self.get_debug_result(sort_by_time))
def save_tensors(params): def save_tensors(params):
"""Save parameter dictionary to binary bytes. """Save parameter dictionary to binary bytes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment