antimora opened a new issue #4568: [Feature] Support for NonZero ONNX operator
URL: https://github.com/apache/incubator-tvm/issues/4568
 
 
   Filing this ticket to request support for [NonZero ONNX 
operator](https://github.com/onnx/onnx/blob/master/docs/Operators.md#NonZero) 
which has been available since version 9 of the default ONNX operator set. 
Since [PyTorch 1.2](https://github.com/pytorch/pytorch/releases/tag/v1.2.0), 
ONNX exports with opset 9 as default (And currently Pytorch only exports with 9 
and 10 opset versions).
   
   Unless there is some work around this deficiency I cannot use my model with 
the latest version ( master@e6ff3f701b2bf3e2204709aea392b0abdf6a85d0).
   
   Here is a small model to recreate the issue:
   
[trouble.zip](https://github.com/apache/incubator-tvm/files/3993200/trouble.zip).
 Zip includes onnx, onnxtxt and graph files. 
   
   Here is python code to try with:
   
   ```python
   
   import onnx
   import numpy as np
   import tvm
   import tvm.relay as relay
   
   onnx_model = onnx.load('trouble.onnx')
   
   input1 = np.random.rand(1, 192, 100)
   input2 = np.random.rand(1)
   
   target = 'llvm'
   
   shape_dict = {'0': input1.shape, '1': input2.shape}
   mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
   
   ```
   Here is the error message:
   
   ```
   rroot@future:/workspace# /usr/bin/python3 /workspace/trouble_onnx.py
   Traceback (most recent call last):
   
     File "/workspace/trouble_onnx.py", line 15, in <module>
       mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
   
     File "/workspace/python/tvm/relay/frontend/onnx.py", line 1601, in 
from_onnx
       mod, params = g.from_onnx(graph, opset)
   
     File "/workspace/python/tvm/relay/frontend/onnx.py", line 1406, in 
from_onnx
       raise tvm.error.OpNotImplemented(msg)
   
   tvm.error.OpNotImplemented: The following operators are not supported for 
frontend ONNX: NonZero
   ```
   
   Please note this onnx model will also fail with missing Expand operator for 
the tvm 0.6 version but this has been fixed by: 
https://github.com/apache/incubator-tvm/pull/4483

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to