-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
[Sparse] Raise exception when expand is called on sparse tensor #98365
Conversation
It's already not working, but this makes error message a bit more readable. I.e. it turns: ``` % python -c "import torch;x=torch.eye(3).to_sparse().expand(3,3)" ``` from ``` NotImplementedError: Could not run 'aten::as_strided' with arguments from the 'SparseCPU' backend. ``` to ``` RuntimeError: Expand is unsupported for Sparse tensors. ```
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/98365
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit ef8049c: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@cpuhrsch do you know why why |
@malfet This is because >>> torch.eye(3).to_sparse_csr().is_sparse
False
>>> torch.eye(3).to_sparse_csr().is_sparse_csr
True (
sparse compressed tensor implementation defines |
@pearu then perhaps the documentation should be updated, because according to it:
Let me dry that in separate PR, as I believe |
IMO: We should break that compatibility. We are still operating under the The docs also probably need a review to make sure that any place where "sparse layout" refers specifically to "sparse_coo" is clarified. |
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.
LGTM! Thanks, @malfet!
Yes, the docs need an update. In fact, I think we should just deprecate the usage of That is, instead of For example, we often use |
@pytorchbot merge |
Merge failedReason: Approval needed from one of the following: |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
The merge job was canceled. If you believe this is a mistake,then you can re trigger it through pytorch-bot. |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
It's already not working, but this makes error message a bit more readable. I.e. it turns:
from
to
cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer