KeyError: 'input.1' (when compiling ONNX model)

Hi everyone,

So I’m trying to compile my ONNX Pytorch model, the first one works but the second model gives “KeyError: ‘input.1’” as error, even though that’s the input together with “1”.

Here is the piece of code:

shape_dict_matrix = { ‘input.1’: (1,256,64,64),‘1’: (1,256,64,83) }

mod_matrix, params_matrix = relay.frontend.from_onnx(matrix_model, shape_dict_matrix)

with relay.build_config(opt_level=0):

matrix_executor = relay.build_module.create_executor('graph', mod_matrix, tvm.gpu(0), target)

dtype = ‘float32’

matrix_output = matrix_executor.evaluate()(tvm.nd.array(vgg_output.astype(dtype)), **params_matrix).asnumpy()

And here’s the full error:

  File "", line 99, in <module>
    matrix_output = matrix_executor.evaluate()(tvm.nd.array(vgg_output.astype(dtype)), **params_matrix).asnumpy()

  File "C:\Users\Alexa\AppData\Roaming\Python\Python37\site-packages\tvm-0.6.0-py3.7-win-amd64.egg\tvm\relay\", line 333, in _graph_wrapper
    args = self._convert_args(self.mod["main"], args, kwargs)

  File "C:\Users\Alexa\AppData\Roaming\Python\Python37\site-packages\tvm-0.6.0-py3.7-win-amd64.egg\tvm\relay\backend\", line 194, in _convert_args

KeyError: 'input.1'

I did use this pull request to make the Resize op work.

Here are the model properties:

would be great if you can dig a bit further, e.g. provide a few traces, print out the keys at the error point and have a script that can reproduce the error

Sure, here are my models with the script:

I use ONNX 1.6 together with to make the Resize op work. I’d have to build TVM with debug as I only have the release version right now.