Specialize BroadcastIndexesRange for the case where there is only 1 contiguous input#12023
Merged
Conversation
Contributor
Author
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12023
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c11e1bd with merge base f673a4b ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
swolchok
added a commit
that referenced
this pull request
Jun 26, 2025
…ontiguous input In this case, broadcasting is not possible if I understand correctly. NOTE TO REVIEWERS: I deleted a failing test because I think it's testing not-actually-existent-in-PyTorch functionality. Please let me know if I've made a mistake. I tried to exercise the behavior that this test implied existed like so: ``` >>> t = torch.tensor([1, 2, 3]) >>> t2 = torch.tensor(4) >>> torch.abs(t2, out=t) <stdin>:1: UserWarning: An output with one or more elements was resized since it had shape [3], which does not match the required output shape []. This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/Resize.cpp:38.) tensor(4) ``` I think that if the test was correct, the result would have been torch.tensor([1, 2, 3]) with no message. Also, none of our operator tests seem to be failing. Have I missed anything? ghstack-source-id: ad2d09d ghstack-comment-id: 3010027375 Pull-Request-resolved: #12023
This was referenced Jun 26, 2025
[ghstack-poisoned]
[ghstack-poisoned]
Contributor
Author
|
This is a size win. Size script results below, cases with no change edited out for brevity. test/build_size_test.shbefore: after: test/build_optimized_size_test.shbefore: after: |
a3f0bf7 to
665c8f0
Compare
swolchok
added a commit
that referenced
this pull request
Jun 30, 2025
…ontiguous input In this case, broadcasting is not possible if I understand correctly. NOTE TO REVIEWERS: I deleted a failing test because I think it's testing not-actually-existent-in-PyTorch functionality. Please let me know if I've made a mistake. I tried to exercise the behavior that this test implied existed like so: ``` >>> t = torch.tensor([1, 2, 3]) >>> t2 = torch.tensor(4) >>> torch.abs(t2, out=t) <stdin>:1: UserWarning: An output with one or more elements was resized since it had shape [3], which does not match the required output shape []. This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/Resize.cpp:38.) tensor(4) ``` I think that if the test was correct, the result would have been torch.tensor([1, 2, 3]) with no message. Also, none of our operator tests seem to be failing. Have I missed anything? ghstack-source-id: 37448a6 ghstack-comment-id: 3010027375 Pull-Request-resolved: #12023
manuelcandales
approved these changes
Jul 1, 2025
BujSet
pushed a commit
to BujSet/executorch
that referenced
this pull request
Jul 2, 2025
…ontiguous input (pytorch#12023) In this case, broadcasting is not possible if I understand correctly. NOTE TO REVIEWERS: I deleted a failing test because I think it's testing not-actually-existent-in-PyTorch functionality. Please let me know if I've made a mistake. I tried to exercise the behavior that this test implied existed like so: ``` >>> t = torch.tensor([1, 2, 3]) >>> t2 = torch.tensor(4) >>> torch.abs(t2, out=t) <stdin>:1: UserWarning: An output with one or more elements was resized since it had shape [3], which does not match the required output shape []. This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/Resize.cpp:38.) tensor(4) ``` I think that if the test was correct, the result would have been torch.tensor([1, 2, 3]) with no message. Also, none of our operator tests seem to be failing. Have I missed anything?
Tanish2101
pushed a commit
to Tanish2101/executorch
that referenced
this pull request
Jul 9, 2025
…ontiguous input (pytorch#12023) In this case, broadcasting is not possible if I understand correctly. NOTE TO REVIEWERS: I deleted a failing test because I think it's testing not-actually-existent-in-PyTorch functionality. Please let me know if I've made a mistake. I tried to exercise the behavior that this test implied existed like so: ``` >>> t = torch.tensor([1, 2, 3]) >>> t2 = torch.tensor(4) >>> torch.abs(t2, out=t) <stdin>:1: UserWarning: An output with one or more elements was resized since it had shape [3], which does not match the required output shape []. This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/Resize.cpp:38.) tensor(4) ``` I think that if the test was correct, the result would have been torch.tensor([1, 2, 3]) with no message. Also, none of our operator tests seem to be failing. Have I missed anything?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this case, broadcasting is not possible if I understand correctly.
NOTE TO REVIEWERS: I deleted a failing test because I think it's testing not-actually-existent-in-PyTorch functionality. Please let me know if I've made a mistake. I tried to exercise the behavior that this test implied existed like so:
I think that if the test was correct, the result would have been torch.tensor([1, 2, 3]) with no message. Also, none of our operator tests seem to be failing. Have I missed anything?