-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[composite compliance] _make_wrapper_subclass respect strides #78520
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
[composite compliance] _make_wrapper_subclass respect strides #78520
Conversation
🔗 Helpful links
✅ No Failures (0 Pending)As of commit 06bfd09 (more details on the Dr. CI page): Expand to see more💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
@pytorchbot merge this please |
|
❌ 🤖 pytorchbot command failed: Try |
|
@pytorchbot help |
PyTorchBot HelpMergeRevertRebaseFor more info, consult the wiki. |
|
@pytorchbot merge -g |
|
Hey @kshitij12345. |
#78520) Summary: `at::for_blob` used to short-circuit if first dim had size `0` or if number of dims was `1`. `at::for_blob` is used in `_make_wrapper_subclass` implementation and resulted in `SubclassTensor` having different stride for the above case. ```python import torch from torch.testing._internal.composite_compliance import generate_cct elem = torch.ones(0,).as_strided((0,), (2,), 0) CCT = generate_cct() ret = CCT(elem) print(f"{ret.shape = }, {ret.stride() = }, {ret.elem.shape = }, {ret.elem.stride() = }") ``` Output Before ``` ret.shape = torch.Size([0]), ret.stride() = (1,), ret.elem.shape = torch.Size([0]), ret.elem.stride() = (2,) ``` Output After ``` ret.shape = torch.Size([0]), ret.stride() = (2,), ret.elem.shape = torch.Size([0]), ret.elem.stride() = (2,) ``` Pull Request resolved: #78520 Approved by: https://github.com/zou3519 Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/4dc5992a79c7c41cc65b40376035cd0f8a588826 Reviewed By: b0noI Differential Revision: D36907490 fbshipit-source-id: 47089279fc23be916a48c3196cbc0143547b6046
at::for_blobused to short-circuit if first dim had size0or if number of dims was1.at::for_blobis used in_make_wrapper_subclassimplementation and resulted inSubclassTensorhaving different stride for the above case.Output Before
Output After