Skip to content

[FIX][Relax][ONNX] Inline model-local functions before importing - #21118

Open
sunni13830 wants to merge 1 commit into
apache:mainfrom
sunni13830:fix/onnx-model-local-functions
Open

sunni13830 wants to merge 1 commit into
apache:mainfrom
sunni13830:fix/onnx-model-local-functions

Conversation

@sunni13830

Copy link
Copy Markdown

Summary

A model-local function named Add can resolve to the built-in Add converter even when its body subtracts. Inline model-local functions with ONNX's inliner before importing the graph, so calls execute their function bodies.

Closes #20871.

Tests

Both targeted cases pass against ONNX Runtime. The local Add case returns the subtraction result while the built-in Add still returns the addition result. The test also checks that importing does not mutate the original model. Before the fix, only the model with a local function failed.

The tests used the current Python sources and the existing local LLVM-enabled TVM build.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Relax][ONNX] A model-local Add function executes the built-in Add instead of its Sub body

1 participant