zhangxiao-stack opened a new issue, #15336:
URL: https://github.com/apache/tvm/issues/15336

   I'm translating dynamic shape resnet.onnx file to relax IR format using code 
like below. the input shape is [-1*3*-1*-1]
   ```
       onnx_file = "./resnet50.onnx"
       model = onnx.load(onnx_file)
       ir_mod = from_onnx(model, keep_params_in_input=True)
       relax_mod, params = relax.frontend.detach_params(ir_mod)
   ```
   ### Expected behavior
   imported successfully.
   
   ### Actual behavior
   It shows error:
   ```
   Traceback (most recent call last):
     File "resnet.py", line 34, in <module>
       ir_mod = from_onnx(model, keep_params_in_input=True)
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 2175, in from_onnx
       return g.from_onnx(graph, opset)
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 1832, in from_onnx
       self._construct_nodes(graph)
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 1983, in _construct_nodes
       op = self._convert_operator(op_name, inputs, attr, self.opset)
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 2079, in _convert_operator
       sym = op_function(self.bb, inputs, attrs, [self._nodes, self._params])
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 1360, in _impl_v13
       data_shape = [i.value for i in inputs[0].struct_info.shape]
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/relax/frontend/onnx/onnx_frontend.py",
 line 1360, in <listcomp>
       data_shape = [i.value for i in inputs[0].struct_info.shape]
     File 
"/root/.local/lib/python3.8/site-packages/tvm-0.14.dev441+g5dcc25a-py3.8-linux-x86_64.egg/tvm/runtime/object.py",
 line 78, in __getattr__
       raise AttributeError(f"{type(self)} has no attribute {name}") from None
   AttributeError: <class 'tvm.tir.expr.Var'> has no attribute value
   [03:44:24] /root/tvm/src/relax/ir/block_builder.cc:64: Warning: BlockBuilder 
destroyed with remaining blocks!
   ```
   ### Environment
   
   Operating System:linux
   TVM version,:unity 5dcc25a [Unity][Relax][Transform] Do not remove MatchCast 
for RemoveAllUnused (#15290)
   
   ### Steps to reproduce
   
   ```
   import tvm
   import tvm.testing
   from tvm.relay import testing
   from tvm import relax, relay
   from tvm.relax.testing import relay_translator, nn
   from tvm.runtime import vm as vm_rt
   from tvm.script import relax as R
   import numpy as np
   import onnx
   from tvm.relax.frontend.onnx import from_onnx
   from tvm import relax
   if __name__ == "__main__":
   
       onnx_file = "./resnet50.onnx"
       model = onnx.load(onnx_file)
       ir_mod = from_onnx(model, keep_params_in_input=True)
       relax_mod, params = relax.frontend.detach_params(ir_mod)
   ```
   
   ### Triage
   
   Please refer to the list of label tags 
[here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the 
relevant tags and add them below in a bullet format (example below).
   
   * needs-triage
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to