Aharrypotter commented on PR #19515: URL: https://github.com/apache/tvm/pull/19515#issuecomment-4390815282
> ## Code Review 代码审查 > This pull request adds a systematic verification suite for the Relax ONNX importer using the official ONNX Backend Test Suite, including a new pytest marker and a backend adapter. Review feedback identifies a bug where `tvm.runtime.Tensor` is used instead of `tvm.runtime.NDArray` and a logic error in input mapping where initializers should be filtered out from the graph inputs to align with the ONNX test runner's behavior.此拉取请求为 Relax ONNX 导入器添加了一个系统验证套件,使用官方 ONNX 后端测试套件,包括一个新的 pytest 标记和一个后端适配器。审查反馈指出了一个错误,即在输入映射中使用了 `tvm.runtime.Tensor` 而不是 `tvm.runtime.NDArray` ,并且在输入映射中存在逻辑错误,初始值应从图输入中过滤,以与 ONNX 测试运行器的行为保持一致。 > > I am having trouble creating individual review comments. Click here to see my feedback. > 我在创建单独的审查评论时遇到问题。点击这里查看我的反馈。 Thanks for the review, Addressing both points: **1. `tvm.runtime.Tensor` vs `tvm.runtime.NDArray`** `tvm.runtime.Tensor` is a valid class in the current TVM Python API — it is defined in `tvm.runtime._tensor.Tensor` and inherits from `tvm_ffi.core.Tensor`. It is not an `AttributeError` risk. ```python >>> import tvm >>> hasattr(tvm.runtime.Tensor) True >>> tvm.runtime.Tensor.__mro__ (<class "tvm.runtime._tensor.Tensor">, <class "tvm_ffi.core.Tensor">, ...) ``` **2. Excluding initializers from `graph_input_names`** The ONNX Backend Test data does not use initializers — all inputs (including weights) are provided as `.pb` files. We verified this across multiple models (`test_batchnorm_epsilon`, `test_conv`, `test_matmul_2d`, `test_add`, `test_gemm`): `model.graph.initializer` is always empty. The current positional mapping logic is correct for this test data format. That said, adding the initializer filter is a good defensive measure for robustness — if the test data format ever changes or a third-party test suite uses initializers, the filter would prevent silent misalignment. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
