[Bug] [FRONTEND][ONNX] fails to import FastGelu when bias does not set: UnboundLocalError: cannot access local variable 'x' where it is not associated with a value #17877
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
Expected behavior
The onnx frontend should import the model correctly.
Actual behavior
When importing the onnx model, tvm crashes as follows:
The FastGelu code in the onnx frontend is as follows. The inputs[1] represents the bias, while bias is optional. So, if the statement "if inputs[1]" is false, the variable ''x' is not defined.

Environment
OS: Ubuntu 20.04
TVM: 0.21.dev0(c00f52a)
Steps to reproduce
This bug can be reproduced by the following code with the model in the attachment. As shown in the code, the model can be executed by onnxruntime.
testcase.zip
Triage
cc @KJlaccHoeUM9l
The text was updated successfully, but these errors were encountered: