Tvm: [ONNX] Fix Filed t is not supported in nnvm

Created on 6 Jun 2018  Â·  15Comments  Â·  Source: apache/tvm

Hi
I have a ONNX file exported via pytorch4. Now I import the ONNX file via NNVM as:
onnx_graph = onnx.load('network.onnx')
Then when I do:

sym, params = nnvm.frontend.from_onnx(onnx_graph)
I get the following error:

Traceback (most recent call last):
File "", line 1, in
File "/Users/pallabdatta/nnvm_tvm_npcompiler/np-compiler/tvm/nnvm/python/nnvm/frontend/onnx.py", line 709, in from_onnx
sym, params = g.from_onnx(graph, opset)
File "/Users/pallabdatta/nnvm_tvm_npcompiler/np-compiler/tvm/nnvm/python/nnvm/frontend/onnx.py", line 572, in from_onnx
attr = self._parse_attr(node.attribute)
File "/Users/pallabdatta/nnvm_tvm_npcompiler/np-compiler/tvm/nnvm/python/nnvm/frontend/onnx.py", line 621, in _parse_attr
"Filed {} is not supported in nnvm.".format(f))
NotImplementedError: Filed t is not supported in nnvm.

Can you please help me how to fix this error in tvm/nnvm/python/nnvm/frontend/onnx.py and associated backend?!
thanks a lot,
Pallab

help wanted

All 15 comments

HI @tqchen

this issue is also related to: https://github.com/dmlc/nnvm/issues/433

Can you please suggest me how to fix this issue so that I can import the ONNX model via NNVM FrontEnd.

@fumihwh can you suggest possible fix to this issue?

@tqchen @pallabdatta
Field t means current node has one attribute which type is tensor. BTW, g for graph is also not supported.
I think tensor is quite easier to parse than graph.
By using onnx.mapping.STORAGE_TENSOR_TYPE_TO_FIELD, we can get value of tensor.
Try:

proto = a.t
field = mapping.STORAGE_TENSOR_TYPE_TO_FIELD[
              mapping.TENSOR_TYPE_TO_STORAGE_TENSOR_TYPE[proto.data_type]]
vals = getattr(proto, field)
attrs[a.name] = vals

@fumihwh since you know how to do so, it would be really nice if you could help send a PR to fix onnx frontend for this case. Thanks!

@pallabdatta Could you give me an ONNX pb to test?

Hi Wenhao

Attached is a network with a Constant node.

On Thu, Jun 14, 2018 at 5:47 AM, Wenhao Hu notifications@github.com wrote:

@pallabdatta https://github.com/pallabdatta Could you give me an ONNX
pb to test?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dmlc/tvm/issues/1236#issuecomment-397281854, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AJ0T-XyEyZYOkP5g-rx1fwuK-s8fptMfks5t8ltagaJpZM4Ubxio
.

Attached it as a .log file.

network.log

@pallabdatta
Plz send your network again...
The above comment does not contain any info about that..

@pallabdatta Plz grant permission..

Done..

@pallabdatta not yet...I can't access that......

Can you please try now..

@pallabdatta Could you try #1300 ?

Thank you @fumihwh it works now..!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tqchen picture tqchen  Â·  28Comments

jroesch picture jroesch  Â·  75Comments

tqchen picture tqchen  Â·  27Comments

joshpoll picture joshpoll  Â·  28Comments

ZihengJiang picture ZihengJiang  Â·  36Comments