Add to and contiguous to stable ops#169709
Closed
mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/396/basefrom
Closed
Add to and contiguous to stable ops#169709mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/396/basefrom
mikaylagawarecki wants to merge 4 commits intogh/mikaylagawarecki/396/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/169709
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 3c28de6 with merge base 5d1459a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
[ghstack-poisoned]
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet) [ghstack-poisoned]
Collaborator
|
Starting merge as part of PR stack under #169711 |
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet) [ghstack-poisoned]
Collaborator
|
Starting merge as part of PR stack under #169711 |
This was referenced Nov 19, 2025
Collaborator
|
Starting merge as part of PR stack under #169711 |
pytorchmergebot
pushed a commit
that referenced
this pull request
Dec 8, 2025
… version (#169711) Pull Request resolved: #169711 Approved by: https://github.com/albanD ghstack dependencies: #169703, #169709
JacobSzwejbka
pushed a commit
that referenced
this pull request
Dec 8, 2025
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet) Pull Request resolved: #169709 Approved by: https://github.com/albanD ghstack dependencies: #169703
JacobSzwejbka
pushed a commit
that referenced
this pull request
Dec 8, 2025
… version (#169711) Pull Request resolved: #169711 Approved by: https://github.com/albanD ghstack dependencies: #169703, #169709
pytorchmergebot
pushed a commit
that referenced
this pull request
Dec 8, 2025
Pull Request resolved: #168062 Approved by: https://github.com/albanD ghstack dependencies: #169703, #169709, #169711
liangxs
pushed a commit
to liangxs/pytorch
that referenced
this pull request
Dec 9, 2025
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet) Pull Request resolved: pytorch#169709 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703
liangxs
pushed a commit
to liangxs/pytorch
that referenced
this pull request
Dec 9, 2025
… version (pytorch#169711) Pull Request resolved: pytorch#169711 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709
liangxs
pushed a commit
to liangxs/pytorch
that referenced
this pull request
Dec 9, 2025
Pull Request resolved: pytorch#168062 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709, pytorch#169711
liangxs
pushed a commit
to liangxs/pytorch
that referenced
this pull request
Dec 9, 2025
…ch_call_dispatcher) (pytorch#169872) Scalar's StableIValue conversion is not supported yet. If we don't land this we can recommend `fill_(empty(...))` instead Pull Request resolved: pytorch#169872 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709, pytorch#169711, pytorch#168062
pytorchmergebot
pushed a commit
that referenced
this pull request
Dec 9, 2025
From https://github.com/pytorch/audio/blob/main/src/libtorchaudio/stable/ops.h Technically it should have been ok not to port these but looking at these carefully I realized the subtract ported to audio ~would have undefined behavior :/~ is broken ``` inline Tensor subtract(const Tensor& self, const Tensor& other) { const auto num_args = 2; std::array<StableIValue, num_args> stack{ torch::stable::detail::from(self), torch::stable::detail::from(other)}; TORCH_ERROR_CODE_CHECK(torch_call_dispatcher( "aten::subtract", "Tensor", stack.data(), TORCH_ABI_VERSION)); return torch::stable::detail::to<torch::stable::Tensor>(stack[0]); } ``` as it missed `alpha` the signature for `subtract.Tensor` is `func: subtract.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor`. ~This is also our bad as although out of bounds reads on the stableivalue stack would be caught by asan, without asan they are silent correctness issues (PR coming to fix).~ Use the old path to support this as we don't support stableivalue conversion for Scalar yet. Pull Request resolved: #169880 Approved by: https://github.com/albanD ghstack dependencies: #169703, #169709, #169711, #168062, #169872
tiendatngcs
pushed a commit
to tiendatngcs/pytorch-Dec25
that referenced
this pull request
Dec 9, 2025
ghstack-source-id: 028736d Pull Request resolved: pytorch/pytorch#169709
skpark-rh
pushed a commit
to skpark-rh/pytorch
that referenced
this pull request
Dec 10, 2025
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet) Pull Request resolved: pytorch#169709 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703
skpark-rh
pushed a commit
to skpark-rh/pytorch
that referenced
this pull request
Dec 10, 2025
… version (pytorch#169711) Pull Request resolved: pytorch#169711 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709
skpark-rh
pushed a commit
to skpark-rh/pytorch
that referenced
this pull request
Dec 10, 2025
Pull Request resolved: pytorch#168062 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709, pytorch#169711
skpark-rh
pushed a commit
to skpark-rh/pytorch
that referenced
this pull request
Dec 10, 2025
…ch_call_dispatcher) (pytorch#169872) Scalar's StableIValue conversion is not supported yet. If we don't land this we can recommend `fill_(empty(...))` instead Pull Request resolved: pytorch#169872 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709, pytorch#169711, pytorch#168062
skpark-rh
pushed a commit
to skpark-rh/pytorch
that referenced
this pull request
Dec 10, 2025
…ch#169880) From https://github.com/pytorch/audio/blob/main/src/libtorchaudio/stable/ops.h Technically it should have been ok not to port these but looking at these carefully I realized the subtract ported to audio ~would have undefined behavior :/~ is broken ``` inline Tensor subtract(const Tensor& self, const Tensor& other) { const auto num_args = 2; std::array<StableIValue, num_args> stack{ torch::stable::detail::from(self), torch::stable::detail::from(other)}; TORCH_ERROR_CODE_CHECK(torch_call_dispatcher( "aten::subtract", "Tensor", stack.data(), TORCH_ABI_VERSION)); return torch::stable::detail::to<torch::stable::Tensor>(stack[0]); } ``` as it missed `alpha` the signature for `subtract.Tensor` is `func: subtract.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor`. ~This is also our bad as although out of bounds reads on the stableivalue stack would be caught by asan, without asan they are silent correctness issues (PR coming to fix).~ Use the old path to support this as we don't support stableivalue conversion for Scalar yet. Pull Request resolved: pytorch#169880 Approved by: https://github.com/albanD ghstack dependencies: pytorch#169703, pytorch#169709, pytorch#169711, pytorch#168062, pytorch#169872
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.
contiguous is also a method on the non-stable Tensor, but we don't add it to stable::Tensor (yet)
Stack from ghstack (oldest at bottom):