Tuningonnx model, encounter a error: num_states = states_list[0][3].size IndexError: list index out of range


#1

when i run tune_relay_x86.py to tuning my onnx model ,encounter a error:
num_states = states_list[0][3].size
IndexError: list index out of range

the following log
tune_graph
[21:30:56] /home/zoloz/erdong/tvm/src/relay/pass/pass_manager.cc:312: Executing function pass : InferType with opt level: 0

2019-06-15 21:30:57,660 INFO Start to benchmark layout transformation…

2019-06-15 21:30:57,661 INFO Benchmarking layout transformation successful.

2019-06-15 21:30:57,661 INFO Start to run dynamic programming algorithm…

2019-06-15 21:30:57,661 INFO Start forward pass…

2019-06-15 21:30:57,661 INFO Finished forward pass.

2019-06-15 21:30:57,661 INFO Start backward pass…

Traceback (most recent call last):

File “tune_relay_x86.py”, line 236, in <module>

tune_and_evaluate(tuning_option)

File “tune_relay_x86.py”, line 210, in tune_and_evaluate

tune_graph(net, data_shape, log_file, graph_opt_sch_file)

File “tune_relay_x86.py”, line 191, in tune_graph

executor.run()

File “/home/zoloz/erdong/env/tvm/python/tvm/autotvm/graph_tuner/dynamic_programming_tuner.py”, line 188, in run

self._backward()

File “/path/to/tvm/python/tvm/autotvm/graph_tuner/dynamic_programming_tuner.py”, line 93, in _backward

num_states = states_list[0][3].size

IndexError: list index out of range


#2

Did you ever solve this?


#3

I managed to solve this problem by changing this line in the tune_graph function.

executor = Tuner(graph, {"data": dshape}, records, targer_op, target)
# to
executor = Tuner(graph, {"0": dshape}, records, targer_op, target)
# The reason of this change is that my input name for the graph is '0', not 'data'.

You’ll also need to change one more occurence of that input name at the evaluation phase, too.