Skip to content

Commit

Permalink
Fix an OrderDict initilization bug.
Browse files Browse the repository at this point in the history
  The dict which is used to initilize OrderDict is not ordered, so
  metadata may not be at the end.
  • Loading branch information
Li Xiaoquan committed Mar 20, 2019
1 parent 89acfeb commit 34802fa
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/tvm/relay/backend/graph_runtime_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@ def nested_defaultdict():
metadata['signatures']['default']['outputs'][node_name]['shape'] = shapes[node_id[0]]

# Keep 'metadata' always at end
json_dict = OrderedDict({
"nodes": nodes,
"arg_nodes": arg_nodes,
"heads": heads,
"attrs": attrs,
"node_row_ptr": node_row_ptr,
"metadata": metadata
})
json_dict = OrderedDict([
("nodes", nodes),
("arg_nodes", arg_nodes),
("heads", heads),
("attrs", attrs),
("node_row_ptr", node_row_ptr),
("metadata", metadata),
])

return json.dumps(json_dict, indent=2)

Expand Down

0 comments on commit 34802fa

Please sign in to comment.