Repository navigation
preserve output tensor's stride in TI's fast setup - #38895
Closed
glaringlee wants to merge 5 commits into
Closed
glaringlee wants to merge 5 commits into
glaringlee wants to merge 5 commits into
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 2cc392a (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 1 failure confirmed as flaky and can be ignored:
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 11 times. |
For non-contiguous, non-overlapping and dense tensors, if they have same shape, we can still do fast setup (flatten to 1d tensor and loop on this 1d tensor) in tensor iterator (IT). There is a case, when input tensors all have the same strides but output tensors don't have the same strides as input tensors, the previous behavior is that we re-stride the output tensors to the same strides as input tensors so all the tensors have the same shape + strides and fast setup can be applied. But this is not compatible with numpy behavior, in numpy, if output tensors' shape are the same as input tensors, their strides are preserved. This PR is to make tensor iterator apply the same behavior as numpy. We no longer re-stride output tensor, but for undefined output tensor, we still do allocation. This is to fix #38107 Differential Revision: [D21696586](https://our.internmc.facebook.com/intern/diff/D21696586) [ghstack-poisoned]
ngimel
approved these changes
Jun 16, 2020
For non-contiguous, non-overlapping and dense tensors, if they have same shape, we can still do fast setup (flatten to 1d tensor and loop on this 1d tensor) in tensor iterator (IT). There is a case, when input tensors all have the same strides but output tensors don't have the same strides as input tensors, the previous behavior is that we re-stride the output tensors to the same strides as input tensors so all the tensors have the same shape + strides and fast setup can be applied. But this is not compatible with numpy behavior, in numpy, if output tensors' shape are the same as input tensors, their strides are preserved. This PR is to make tensor iterator apply the same behavior as numpy. We no longer re-stride output tensor, but for undefined output tensor, we still do allocation. This is to fix #38107 Differential Revision: [D21696586](https://our.internmc.facebook.com/intern/diff/D21696586) [ghstack-poisoned]
For non-contiguous, non-overlapping and dense tensors, if they have same shape, we can still do fast setup (flatten to 1d tensor and loop on this 1d tensor) in tensor iterator (IT). There is a case, when input tensors all have the same strides but output tensors don't have the same strides as input tensors, the previous behavior is that we re-stride the output tensors to the same strides as input tensors so all the tensors have the same shape + strides and fast setup can be applied. But this is not compatible with numpy behavior, in numpy, if output tensors' shape are the same as input tensors, their strides are preserved. This PR is to make tensor iterator apply the same behavior as numpy. We no longer re-stride output tensor, but for undefined output tensor, we still do allocation. This is to fix #38107 Differential Revision: [D21696586](https://our.internmc.facebook.com/intern/diff/D21696586) [ghstack-poisoned]
For non-contiguous, non-overlapping and dense tensors, if they have same shape, we can still do fast setup (flatten to 1d tensor and loop on this 1d tensor) in tensor iterator (IT). There is a case, when input tensors all have the same strides but output tensors don't have the same strides as input tensors, the previous behavior is that we re-stride the output tensors to the same strides as input tensors so all the tensors have the same shape + strides and fast setup can be applied. But this is not compatible with numpy behavior, in numpy, if output tensors' shape are the same as input tensors, their strides are preserved. This PR is to make tensor iterator apply the same behavior as numpy. We no longer re-stride output tensor, but for undefined output tensor, we still do allocation. This is to fix #38107 Differential Revision: [D21696586](https://our.internmc.facebook.com/intern/diff/D21696586) [ghstack-poisoned]
Contributor
|
@glaringlee merged this pull request in 645d6c0. |
xwang233
pushed a commit
to xwang233/pytorch
that referenced
this pull request
Jun 20, 2020
Summary: Pull Request resolved: pytorch#38895 Test Plan: Imported from OSS Differential Revision: D21696586 Pulled By: glaringlee fbshipit-source-id: c7206dbcf74d30998544e221cd0c998c4c25663a
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.
Stack from ghstack:
For non-contiguous, non-overlapping and dense tensors, if they have same shape, we can still do fast setup (flatten to 1d tensor and loop on this 1d tensor) in tensor iterator (IT). There is a case, when input tensors all have the same strides but output tensors don't have the same strides as input tensors, the previous behavior is that we re-stride the output tensors to the same strides as input tensors so all the tensors have the same shape + strides and fast setup can be applied. But this is not compatible with numpy behavior, in numpy, if output tensors' shape are the same as input tensors, their strides are preserved. This PR is to make tensor iterator apply the same behavior as numpy. We no longer re-stride output tensor, but for undefined output tensor, we still do allocation.
This is to fix #38107
Differential Revision: D21696586