From e85284113ffe3e2076c2ddf5a4540a29f3bd5134 Mon Sep 17 00:00:00 2001 From: lixiaoquan Date: Thu, 21 Mar 2019 01:01:13 +0800 Subject: [PATCH] Fix an OrderDict initilization bug. (#2862) The dict which is used to initilize OrderDict is not ordered, so metadata may not be at the end. --- .../tvm/relay/backend/graph_runtime_codegen.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/tvm/relay/backend/graph_runtime_codegen.py b/python/tvm/relay/backend/graph_runtime_codegen.py index e31b44df81ba9..0409c8dd73907 100644 --- a/python/tvm/relay/backend/graph_runtime_codegen.py +++ b/python/tvm/relay/backend/graph_runtime_codegen.py @@ -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)