This is an automated email from the ASF dual-hosted git repository.
tlopex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 1e28bf9424 [Relax][ONNX] Fix bug: Unsupported numpy or ml_dtypes
dtype('O') when importing ONNX model using Relax frontend (#18416)
1e28bf9424 is described below
commit 1e28bf9424271e441fdb6702ec6086ec4abe688f
Author: Neo Chien <[email protected]>
AuthorDate: Mon Nov 3 23:19:45 2025 +0800
[Relax][ONNX] Fix bug: Unsupported numpy or ml_dtypes dtype('O') when
importing ONNX model using Relax frontend (#18416)
[#18397] Fix bug: Unsupported numpy or ml_dtypes dtype('O') when importing
ONNX model using Relax frontend
Co-authored-by: cchung100m <[email protected]>
---
python/tvm/relax/frontend/onnx/onnx_frontend.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/python/tvm/relax/frontend/onnx/onnx_frontend.py
b/python/tvm/relax/frontend/onnx/onnx_frontend.py
index 3b94ba1d66..2e4e7a3125 100644
--- a/python/tvm/relax/frontend/onnx/onnx_frontend.py
+++ b/python/tvm/relax/frontend/onnx/onnx_frontend.py
@@ -340,6 +340,8 @@ class BinaryBase(OnnxOpConverter):
x = _to_numpy(inputs[0])
y = _to_numpy(inputs[1])
output = cls.numpy_op(x, y) # pylint: disable=not-callable
+ if isinstance(x, relax.PrimValue) and isinstance(y,
relax.PrimValue):
+ return relax.PrimValue(output.item())
if x.dtype == y.dtype:
# no numpy precision widening
output = output.astype(x.dtype)