onnxruntime
08535091 - Fix ONNX node test tensor type conversion (#33150)

Commit
1 day ago
Fix ONNX node test tensor type conversion (#33150) ### Description <!-- Describe your changes. --> Convert serialized ONNX `TensorProto::DataType` values to ABI-stable `ONNXTensorElementDataType` values before creating tensors in the ONNX node-test loader. Add the missing `FLOAT8E8M0` conversion. This fixes the materialized ONNX node tests for `FLOAT8E8M0`, `UINT2`, and `INT2`, whose serialized values 24-26 differ from the corresponding C API enum values after #33066. Validation: - `lintrunner -a onnxruntime/test/onnx/tensorprotoutils.cc` — passed. - `cmake --build build/linux_cuda/Release --target onnx_test_runner -j \"$(nproc)\"` — passed. - `./onnx_test_runner -e cpu -n cast_FLOAT_to_UINT2 _deps/onnx-src/onnx/backend/test/data/node` — passed (1 test). - `./onnx_test_runner -e cpu -n cast_FLOAT_to_INT2 _deps/onnx-src/onnx/backend/test/data/node` — passed (1 test). - `./onnx_test_runner -e cpu -n cast_e8m0_FLOAT_to_FLOAT8E8M0 _deps/onnx-src/onnx/backend/test/data/node` — no failure; the local CPU build reports the operator as not implemented. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> The Windows x64 QNN CI on `main` fails both static and shared configurations because the node-test loader casts ONNX wire type numbers directly to the C API enum. That cast permutes `FLOAT8E8M0`, `UINT2`, and `INT2`, producing input/output type mismatches and packed-buffer size errors in 38 materialized node tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
Parents
Loading