-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
torch.jit.trace
appears to convert integer division to tensor division
#62707
Comments
Thanks for raising this up, @StephenHogg. Einops relies on floor division for computation of axes dimensions, and there is no way to change it. Jit would be broken thus for any pytorch code operating with axis manipulations. |
Hey torch team, it worth implementing proper translation for |
Hi @arogozhnikov, Thanks for reporting this issue.
Additionally, currently implementation of
|
Ready to do so, right after it becomes any decent, here is a list of what is missing, and see discussion: Since I don't expect torch.jit.script to have this level of support, there is currently no solution to problem.
if you analyze the code posted and forget about jit, you'll see it's a well-defined piece of code that operates with integer. So, plain simple: function works, doesn't know and never uses pytorch's buggy implementation, uses only built-in div, and it should be translated to correct counterpart in jit. Specifying floordiv for shape components sounds doable if there is an appropriate abstraction in internal representation. If not - mapping Risk-thinking, I don't see a case when one wants incorrect behavior of floordiv that doesn't match numpy and built-in - that sounds too crazy. |
@gmagogsfm Can you clarify, why is this issue closed? |
🐛 Bug
As per this issue in einops, it appears that
torch.jit.trace
is converting integer division to tensor division.To Reproduce
Steps to reproduce the behavior:
The warning provided is as follows:
Expected behavior
The division in that function shouldn't be getting converted to tensor division.
Environment
cc @gmagogsfm
The text was updated successfully, but these errors were encountered: