-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Don't truncate leading 1s if they are unbacked #95141
Conversation
If it's just right, broadcasting will do the right thing automatically. This helps with unbacked SymInts as I can avoid testing one equality on the inside. Signed-off-by: Edward Z. Yang <ezyangmeta.com> [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/95141
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit fe43676: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
If it's just right, broadcasting will do the right thing automatically. This helps with unbacked SymInts as I can avoid testing one equality on the inside. Signed-off-by: Edward Z. Yang <ezyangmeta.com> ghstack-source-id: 905f6454a7897951ba156367c53ab515e71faf19 Pull Request resolved: #95141
If it's just right, broadcasting will do the right thing automatically. This helps with unbacked SymInts as I can avoid testing one equality on the inside. The previous attempt at #94521 I got the logic a bit wrong. I need to compute the difference between the data to be set, and the post-slice space for the values. But I incorrectly compared against the *pre-slice* space in the original PR. Another version of this PR which is wrong is to compare against variableIndices.size(); but remember that in advanced indexing with tensors/lists, each of the individual indices specify what coordinates to read out of each dimension; so to get the post-slice space you have to look at the dim of the advanced index itself! There is now a test for this. Signed-off-by: Edward Z. Yang <ezyangmeta.com> [ghstack-poisoned]
If it's just right, broadcasting will do the right thing automatically. This helps with unbacked SymInts as I can avoid testing one equality on the inside. Signed-off-by: Edward Z. Yang <ezyangmeta.com> ghstack-source-id: abc461993881c6398e318b3e0dd3b858a6d22e44 Pull Request resolved: #95141
This prevents us from guarding on leading unbacked SymInts. The previous attempt at #94521 I got the logic a bit wrong. My idea there was to avoid slicing when the values to be set have low enough dimensionality that they definitely aren't too long. To do this, I need to compute the difference between the data to be set, and the post-slice space for the values. But I incorrectly compared against the *pre-slice* space in the original PR. Another version of this PR which is wrong is to compare against variableIndices.size(); but remember that in advanced indexing with tensors/lists, each of the individual indices specify what coordinates to read out of each dimension! A third incorrect attempt tested `variableIndices[0].dim()`, which is only correct if you don't broadcast one of the later variable indices, and if there are enough variableIndices to cover all dims. This is all quite complicated, so I went for a simpler solution of checking if the leading dim had a hint before testing if it is not equal to one. BTW, there is no test for this one stripping behavior. There is now a test for this, based off the real code that caused the problem. Signed-off-by: Edward Z. Yang <ezyangmeta.com> [ghstack-poisoned]
@pytorchbot merge |
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 |
This reverts commit 77dae43.
This prevents us from guarding on leading unbacked SymInts. The previous attempt at pytorch#94521 I got the logic a bit wrong. My idea there was to avoid slicing when the values to be set have low enough dimensionality that they definitely aren't too long. To do this, I need to compute the difference between the data to be set, and the post-slice space for the values. But I incorrectly compared against the *pre-slice* space in the original PR. Another version of this PR which is wrong is to compare against variableIndices.size(); but remember that in advanced indexing with tensors/lists, each of the individual indices specify what coordinates to read out of each dimension! A third incorrect attempt tested `variableIndices[0].dim()`, which is only correct if you don't broadcast one of the later variable indices, and if there are enough variableIndices to cover all dims. This is all quite complicated, so I went for a simpler solution of checking if the leading dim had a hint before testing if it is not equal to one. BTW, there is no test for this one stripping behavior. There is now a test for this, based off the real code that caused the problem. Signed-off-by: Edward Z. Yang <ezyangmeta.com> Pull Request resolved: pytorch#95141 Approved by: https://github.com/ngimel
Stack from ghstack (oldest at bottom):
This prevents us from guarding on leading unbacked SymInts.
The previous attempt at #94521 I got the logic a bit wrong. My idea there was to avoid slicing when the values to be set have low enough dimensionality that they definitely aren't too long. To do this, I need to compute the difference between the data to be set, and the post-slice space for the values. But I incorrectly compared against the pre-slice space in the original PR. Another version of this PR which is wrong is to compare against variableIndices.size(); but remember that in advanced indexing with tensors/lists, each of the individual indices specify what coordinates to read out of each dimension! A third incorrect attempt tested
variableIndices[0].dim()
, which is only correct if you don't broadcast one of the later variable indices, and if there are enough variableIndices to cover all dims. This is all quite complicated, so I went for a simpler solution of checking if the leading dim had a hint before testing if it is not equal to one.BTW, there is no test for this one stripping behavior. There is now a test for this, based off the real code that caused the problem.
Signed-off-by: Edward Z. Yang <ezyangmeta.com>