-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ONNX][dynamo_export] ONNX::Celu Half unsupported but export passed w/ invalid model when opmath disabled #113808
Comments
|
Yes it falls under ONNX point 1. I am now inclined to have the converter examine opschema and insert casts for this case, because torchlib doesn’t have information on the output tensor type, only that of the inputs. So even though it may be able to add casts to inputs we still need to cast the outputs somewhere. The converter is in the best position to do so because it knows what the output type should be. |
Based on #113780, it seems that adding upcast in converter side is not preferred, since the optimization can't tell it's from models or type promotion? |
What I understand is we don’t prefer always adding upcasts, but we will still need to cast when we actually need them (for onnx support). The current promotion logic doesn’t account for the opschema of the onnx function. |
Oops, it looks like it's not about fallback, it's only nearest match. If we added opschema into type promotion, should we disable nearest match? |
Happy to discuss further offline |
In #113780 I'm experimenting turning off opmath type promotion for export since it inserts upcasts that are hard to reason for backends.
This issue can be reproed by below with the above branch removing the respective xfail.
Without opmath, aten::celu fp16 will be exported as is to onnx::celu. This should be an early export error since onnx::celu does not support half, however the export succeeds with invalid onnx model. Loading it in ORT later emits error
Looking at diagnostics, it turns out that exporter detected the absence of half celu in torchlib, but decides to fallback with the float32 impl.
@justinchuby @titaiwangms
The text was updated successfully, but these errors were encountered: