You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Thrsu (via GitHub)" <gi...@apache.org> on 2023/09/09 17:14:22 UTC

[GitHub] [tvm] Thrsu opened a new issue, #15719: [Bug] [Unity] ValueError: no value in Constant when running ONNX model with tvm.relax

Thrsu opened a new issue, #15719:
URL: https://github.com/apache/tvm/issues/15719

   I encountered an issue when using the `tvm.relax` module to execute an [ONNX model](https://github.com/Thrsu/onnx_model/blob/main/Constant.onnx) that contains a Constant operator. The error message "ValueError: no value in Constant" is raised, despite the fact that the model includes the attribute "value_float" for the Constant operator. Besides, according to the [official ONNX documentation](https://onnx.ai/onnx/operators/onnx__Constant.html#constant-19), the Constant operator can have the attribute "value_float".
   
   ### Expected behavior
   
   The `tvm.relax` module should properly recognize and handle the "value_float" attribute of the Constant operator in the ONNX model.
   
   ### Actual behavior
   
   ```
   Traceback (most recent call last):
     ...
       tvm_model = from_onnx(model, opset=18, keep_params_in_input=True)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2287, in from_onnx
       return g.from_onnx(graph, opset)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 1932, in from_onnx
       self._construct_nodes(graph)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2095, in _construct_nodes
       op = self._convert_operator(op_name, inputs, attr, self.opset)
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 2191, in _convert_operator
       sym = op_function(self.bb, inputs, attrs, [self._nodes, self._params])
     File "/workplace/software/tvm/tvm/python/tvm/relax/frontend/onnx/onnx_frontend.py", line 737, in _impl_v13
       raise ValueError("no value in Constant")
   ValueError: no value in Constan
   ```
   
   ### Environment
   
   - TVM: v0.14.dev0-595-gfa0d35b
   - onnx: 1.14.0
   
   ### Steps to reproduce
   
   ```python
   import onnx
   import tvm
   from tvm import relax
   from tvm.relax.frontend.onnx import from_onnx
   
   onnx_model_path = "Constant.onnx"
   model = onnx.load(onnx_model_path)
   tvm_model = from_onnx(model, opset=18, keep_params_in_input=True)
   ```
   ### Triage
   
   * 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: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org