-
Notifications
You must be signed in to change notification settings - Fork 24.2k
torch.onnx.export causes floating point exception with core dump for empty slice assignment #110056
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
I've tested the same code (command:
|
For new use cases, we recommend the torch.onnx.dynamo() exporting path. PR accepted but it would be unlikely to be picked up soon. Thanks! |
have you solved this issue? I get this error too. |
@ustczhouyu cnt = 0
for h in h_slices:
for w in w_slices:
# slicing with empty range can cause `torch.onnx.export` failure
if (h.stop or H) > (h.start or 0) and (w.stop or W) > (w.start or 0):
img_mask[:, h, w, :] = cnt
cnt += 1 The other way is to use torch.onnx.dynamo_export as @justinchuby said. As this issue is marked as low priority, it looks like PyTorch team is making more efforts to |
@jiwoong-choi , do you have any tips on how did you pinpoint the line that causes the problem? When i checked my export stack trace, i was not able to easily identify the problematic op
|
@YixuanSeanZhou There's no easy way to find the line causing the problem. What I usually do is a manual binary search-like method:
|
🐛 Describe the bug
A simple slice assignment called inside a module causes a floating point exception when the module is exported into the ONNX via
torch.onnx.export
.Floating point exception (core dumped)
.The code for reproducing the error
Let's call it
repro.py
Steps to reproduce
1. Set up environment
See the details about the environment in the Versions section.
2. Run the following command
NOTE: If you give any positive integer value to other than 2 to the
-s
flag, the script runs normally.The Output
In my opinion, expected behavior are:
However, the error message on Ubuntu wasn't helpful to find out the root cause of the core dump. (Empty slice assignment doesn't look very relevant to floating point exception in my opinion.)
It was nice that the code worked on MacOS, but the warning message was still not very helpful.
Ubuntu 22.04
MacOS Ventura 13.4.1
Versions
Ubuntu server
MacOS laptop
The text was updated successfully, but these errors were encountered: