-
Notifications
You must be signed in to change notification settings - Fork 25.6k
add layout to slow path #80429
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
add layout to slow path #80429
Conversation
[ghstack-poisoned]
🔗 Helpful links
✅ No Failures (0 Pending)As of commit dd68cb4 (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. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
While this PR is logical, it is not clear to me why it is necessary. Can you elaborate more on the use case? |
Yep! We’re trying to implement sparse CSR support in MaskedTensor (see pytorch/maskedtensor#65), and while performing operations like .to_dense(), it ends up calling |
torch/csrc/utils/python_arg_parser.h
Outdated
} | ||
const auto layout = THPUtils_unpackLong(obj); | ||
TORCH_CHECK(layout >= 0, "Layout must not be negative"); | ||
return static_cast<at::Layout>(layout); |
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.
This is the thing where __torch_dispatch__
gives you an integer instead of the layout object, right? This should get fixed by https://github.com/pytorch/pytorch/pull/77543/files Do you still need this logic?
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.
Additionally, this doesn't do any checking that the integer corresponds to a real layout
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.
Yeah I think you're right - I don't think it's needed, was put there more just in case. I'll remove it!
[ghstack-poisoned]
[ghstack-poisoned]
@pytorchbot merge |
@pytorchbot successfully started a merge job. Check the current status here |
Hey @george-qi. |
Summary: Pull Request resolved: #80429 Approved by: https://github.com/ezyang Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/393f7f6ad7b10adc44500eaead13044efd8c698b Reviewed By: mehtanirav Differential Revision: D37687406 Pulled By: george-qi fbshipit-source-id: 62e53ac714642d9582719377c0ef8082e383dc3a
Stack from ghstack: