You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2019/12/14 04:06:45 UTC
[GitHub] [incubator-tvm] anwang2009 opened a new issue #4521: ONNX importer
ModelParams bug
anwang2009 opened a new issue #4521: ONNX importer ModelParams bug
URL: https://github.com/apache/incubator-tvm/issues/4521
Using the onnx importer on mobilenetv2-1.0 with opset 7, `relay_params` appears to have an extra parameter as compared to `relay_model`'s parameters.
Here's a repro of the bug:
```
import tempfile
import urllib.request
from tvm.relay import Module
import onnx
from tvm.relay.frontend import from_onnx
def onnx_workload():
tmpfile = tempfile.NamedTemporaryFile('w+b')
mobilenet_url = 'https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.onnx'
urllib.request.urlretrieve(mobilenet_url, tmpfile.name)
tmpfile.seek(0)
return tmpfile
onnx_model = onnx.load(onnx_workload())
input_shape = {"data": [1, 3, 224, 224]}
relay_model, relay_params = from_onnx(onnx_model, shape=input_shape)
var_map = {}
for fn_param in relay_model['main'].params:
var_map[fn_param.name_hint] = fn_param
# reshape_attr_tensor421 is in params but not the module
print("reshape_attr_tensor421 is in relay_params", "reshape_attr_tensor421" in relay_params)
print("reshape_attr_tensor421 is in relay_model", var_map.get("reshape_attr_tensor421") is not None)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services