coffezhou opened a new issue, #17746:
URL: https://github.com/apache/tvm/issues/17746
### Expected behavior
The onnx frontend should import the model correctly.
### Actual behavior
```c
Traceback (most recent call last):
File "/home/carla/Documents/test_tvm/0312/test_relax1.py", line 13, in
<module>
tvm_model = from_onnx(model, keep_params_in_input=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 3690, in from_onnx
return g.from_onnx(graph, opset)
^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 3321, in from_onnx
self._construct_nodes(graph)
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 3496, in _construct_nodes
op = self._convert_operator(op_name, inputs, attr, self.opset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 3596, in _convert_operator
sym = op_function(self.bb, inputs, attrs, [self._nodes, self._params])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 2688, in _impl_v12
axis, keepdims = cls._check_attrs(data, attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/carla/Documents/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py",
line 2669, in _check_attrs
assert 0 <= axis < dims_num, "Axis is out of bounds"
^^^^^^^^^^^^^^^^^^^^
AssertionError: Axis is out of bounds
```
### Environment
OS: Ubuntu 20.04
TVM: 0.20.dev0 (6e8c367)
### Steps to reproduce
This bug can be reproduced by the following code with the model in the
attachment. For the model, it can be correctly checked by
onnx.checker.check_model. However, the onnx frontend cannot import it.
```python
import tvm
from tvm import relax
from tvm.relax.frontend.onnx import from_onnx
import onnx
model_path = "model.onnx"
model = onnx.load(model_path)
onnx.checker.check_model(model, full_check=True)
tvm_model = from_onnx(model, keep_params_in_input=True)
```
[model.zip](https://github.com/user-attachments/files/19223207/model.zip)
* 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]