Skip to content

Commit

Permalink
Fix an OrderDict initilization bug. (apache#2862)
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
lixiaoquan authored and Laurawly committed Mar 22, 2019
1 parent f7259c2 commit e852841
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 e852841

Please sign in to comment.