Repository navigation
wasi-nn: support all tensor types for ONNX inputs - #15056
Open
ChihweiLHBird wants to merge 1 commit into
Open
ChihweiLHBird wants to merge 1 commit into
ChihweiLHBird wants to merge 1 commit into
Conversation
The ONNX backend can decode only `f32` input tensors. For other types, `compute` returns `UnsupportedTensorType`, so models that take `i64` token IDs cannot run. This change decodes input tensors of all seven wasi-nn tensor types. For `f16` and `bf16`, it uses the `half` crate through the `half` feature of `ort`. The setup step now also accepts models with these types. The change also removes `bytes_to_f32_vec`, which has no users now.
ChihweiLHBird
requested review from
fitzgen and
rvolosatovs
and removed request for
a team
October 29, 2026 06:42
Contributor
Author
|
CC: @rahulchaphalkar |
Contributor
Author
|
CC: @alexcrichton |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ONNX backend can decode only
f32input tensors. For other types,computereturnsUnsupportedTensorType, so models that takei64token IDs cannot run.This change decodes input tensors of all seven wasi-nn tensor types with one generic helper. For
f16andbf16, it turns on thehalffeature ofortand addshalfas a dependency.half2.4.1 is already inCargo.lock, so no new crate comes in. The setup step now also accepts models withf16andbf16tensors. The change also removesbytes_to_f32_vec, which has no users now.Outputs are still
f32only. That can be a follow-up.CI does not run the wasi-nn tests. To run the new unit tests: