-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Using int(shape) in export would result in silent specialization #138853
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
Comments
In non-strict export this is unavoidable, Python's rules for |
Is there a way to fail loudly or print a warning? |
@angelayi this is a funny opposite case to draft export where the size guards would have told you about it but they all got ignored :P |
One view of this is that symbolic_shapes is unable to realize that the guard emitted, Alternatively, If we remove the division op, export raises a specialization error, recognizing that we've specialized. Or on the other hand, if we change the denominator to be > 1, then this guard is true for more than 1 value, and we technically haven't specialized the symbol, but the problem remains that int() silently introduced this equality guard. I think these could be improved:
|
@pianpwk Thanks. I think it makes sense if this cannot be "fixed", but making debugging easier would help already btw noob question: does sym_int work similar to math.trunc in a case like this? |
🐛 Describe the bug
Hi team, just reporting this problem. I can bypass it if I replace int with
math.trunc
.repro:
error:
Versions
trunk
cc @ezyang @chauhang @penguinwu @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4
The text was updated successfully, but these errors were encountered: