-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[draft_export] fix dense-in-memory check for inferring fakes #145653
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
Conversation
Summary: fixes the dense-in-memory check so it doesn't fail on output sizes like `[80, 1, 4]`. more details in the inline comment Test Plan: test_draft_export Differential Revision: D68644028
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/145653
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 653a2aa with merge base d79c6f4 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D68644028 |
@@ -2833,7 +2833,7 @@ def unsupported(reason: str) -> None: | |||
# We went with the first option. | |||
fake_strides = [-1] * real_out.dim() | |||
strides = [(s, idx) for idx, s in enumerate(real_out.stride())] | |||
strides.sort() | |||
strides.sort(key=lambda x: (x[0], -x[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an input like [80, 1, 4]
, this was previously [(1, 2), (4, 0), (4,1)]
, which meant once we processed dim 1, the expected stride is 420 (instead of 80). The fix just sorts dimensions in reverse to avoid this when some dim has shape 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Test Plan: fixes check for dense tensors with size-1 dimensions
Differential Revision: D68644028