-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Add contiguous_strides as a correct replacement of defaultStride #67789
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
`at::defaultStride` was added in #18779 As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. [ghstack-poisoned]
CI Flow Status⚛️ CI FlowRuleset - Version:
You can add a comment to the PR and tag @pytorchbot with the following commands: # ciflow rerun, "ciflow/default" will always be added automatically
@pytorchbot ciflow rerun
# ciflow rerun with additional labels "-l <ciflow/label_name>", which is equivalent to adding these labels manually and trigger the rerun
@pytorchbot ciflow rerun -l ciflow/scheduled -l ciflow/slow For more information, please take a look at the CI Flow Wiki. |
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 65b9aea (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
@IvanYashchuk This correct the error we discussed for matrices with one of its sizes zero being zero. It also simplifies the writing of structured kernesl with fortran backends. |
…Stride" `at::defaultStride` was added in #18779 As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779 As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
auto solution_strides = at::detail::defaultStrides(self_broadcast_size); | ||
solution_strides[ndim - 2] = 1; | ||
solution_strides[ndim - 1] = nrows; | ||
const auto solution_strides = at::native::contiguous_strides(self_broadcast_size, /*f-contig=*/true); |
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.
Thanks for fixing that!
Why the tests were not failing? You mentioned that autograd doesn't like matrices with 0 strides and sample_inputs_linalg_solve
from common_methods_invocations.py
has 0x0 input matrix case.
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.
It's forward AD that was failing. Can it be the case that this function does not support forward AD?
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
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.
Cool!
Let's give @IvanYashchuk and @nikitaved a chance to review, too.
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-p F438 oisoned]
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Maybe we should build with these same flags, @dagitses @malfet, since they block landing? |
I just fixed this one @mruberry. But yes, it'd be great to, at least, add this one flag to the open CI. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…Stride" `at::defaultStride` was added in #18779. As it was noted in that PR, it differs from the actual computation of the default strides when one or more of the dimensions of the tensor are zero. See #18779 (comment) We add two functions, `contiguous_strides` and `contiguous_strides_vec` which correct this issue and we replace the previous (wrong) uses of `defaultStride`. cc jianyuh nikitaved pearu mruberry walterddr IvanYashchuk xwang233 Lezcano Differential Revision: [D32684852](https://our.internmc.facebook.com/intern/diff/D32684852) [ghstack-poisoned]
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Stack from ghstack:
at::defaultStride
was added in #18779.As it was noted in that PR, it differs from the actual computation of
the default strides when one or more of the dimensions of the tensor are
zero. See #18779 (comment)
We add two functions,
contiguous_strides
andcontiguous_strides_vec
which correct this issue and we replace the previous (wrong) uses of
defaultStride
.cc @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @lezcano
Differential Revision: D32684852