-
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
Fixed issue with memory format inconsistency for interpolate op #100373
Conversation
cf459b8
to
e438650
Compare
e438650
to
f327ca8
Compare
# following "heuristic: only use channels_last path when it's faster than the contiguous path" | ||
_, n_channels, _, _ = input.shape | ||
if input.device.type == "cuda" and n_channels < 4: | ||
memory_format = torch.contiguous_format |
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.
Removed this heuristics due to failing test_fake_tensor.py tests and also https://github.com/pytorch/pytorch/pull/91260/files#r1183144329
cc @jbschlosser
@jbschlosser holler if you are not the right person |
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
@pytorchbot merge -r |
This PR needs a
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Description: - Output's memory format is not respected in interpolate op when input is squeezed/unsqueezed channels last
Successfully rebased |
9b9e8d4
to
c469c14
Compare
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@ezyang thanks for the review and the approval. Right now I set this PR to draft as there are failing tests and we also plan to make more tests from torchvision-side |
Related to #68430
Description:
For example:
We can see have the following output on pytorch nightly:
In details, memory format inconsistency comes from the strides:
The problem essentially comes from
x.unsqueeze(0)
where new stride (i.e. stride(0)) is computed as for a tensor with channels first memory format:pytorch/aten/src/ATen/native/TensorShape.cpp
Line 3136 in 4582ceb