File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
python/tvm/relay/frontend Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -5016,14 +5016,13 @@ def from_pytorch(
50165016 func_args .append (arg )
50175017
50185018 # Ensures the order of data_input is the same as the order of inputs specified in input_info.
5019- _data_inputs = []
5020- for input_info in input_infos :
5021- _data_input = [di for di in data_inputs if di .name_hint == input_info [0 ]]
5022- if len (_data_input ) != 1 :
5023- msg = "Unexpected input name ({}) which is unreachable." .format (input_info [0 ])
5024- raise RuntimeError (msg )
5025- _data_inputs .append (_data_input [0 ])
5026- data_inputs = _data_inputs
5019+ order_input_infos = {input_info [0 ]: idx for idx , input_info in enumerate (input_infos )}
5020+ data_inputs = sorted (
5021+ data_inputs ,
5022+ key = lambda data_input : order_input_infos [data_input .name_hint ]
5023+ if data_input .name_hint in order_input_infos
5024+ else - 1 ,
5025+ )
50275026
50285027 func_args = data_inputs + func_args
50295028
You can’t perform that action at this time.
0 commit comments