From 5a0f39b5481a30a2eec49e27cbc17a722bd6ee6a Mon Sep 17 00:00:00 2001 From: pyjhzwh Date: Wed, 4 Mar 2020 04:40:37 -0500 Subject: [PATCH] [Torch] fix unordered dictionary problem for python version under 3.6 (#4982) * fix unordered dictionary problem for python version 3.5 * modify style --- python/tvm/relay/frontend/pytorch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/tvm/relay/frontend/pytorch.py b/python/tvm/relay/frontend/pytorch.py index b256faa..19bccca 100644 --- a/python/tvm/relay/frontend/pytorch.py +++ b/python/tvm/relay/frontend/pytorch.py @@ -918,7 +918,7 @@ def _get_constant(node): def _get_operator_nodes(nodes): """ Returns torch IR nodes that need conversion to Relay """ - ops = {} + ops = [] # Traverse nodes and add to graph for node in nodes: if node.outputsSize() > 1: @@ -927,7 +927,7 @@ def _get_operator_nodes(nodes): node_name = _get_output_name(node) if node.kind() != "prim::GetAttr": - ops[node_name] = node + ops.append((node_name, node)) return ops @@ -1015,7 +1015,7 @@ def parse_params(graph, state_dict): def parse_operators(operators, outputs, output_index_map, ret_name): """ Convert each Torch IR operators to Relay equivalent """ - for node_name, op_node in operators.items(): + for node_name, op_node in operators: operator = op_node.kind() inputs = _get_op_inputs(op_node, outputs, output_index_map) -- 2.7.4