-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Revised sparse tensor documentation. #45400
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
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.
A first review pass.
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.
Only spotted a single sentence; suggested change in comment
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.
That looks very good.
Thanks for taking the time to do this.
I added small comments inline.
|
@vadimkantorov , could you also review this PR which is about updating the |
a30dee7 to
4e46790
Compare
|
This PR is ready for review. Latest updates include:
|
I didn't get the sense from Mike's comments that he wanted substantive code changes in this PR, but let me just reiterate: there should be no code changes here, the docs here are As Is. That being said, if there are some weird parts of the API that we'd plan on just fixing later, we shouldn't be as nitpicky about the docs for those parts in this PR. (Not sure how much is covered by that). |
Sounds good. I hope they're helpful.
Sure.
I understand this PR is just updating the documentation and I agree with @ezyang that it shouldn't include code changes. The API-related questions are to help me understand the language, goals, and motivations of our sparse story so we can be consistent with our documentation. I would actually suggest this PR hew closer to the current state of the code, as mentioned previously, and maybe not try to provide an organizational structure for a new sparse format or mention the concept of a fill value as anything but zero. Following @ezyang's point, where the docs or current functions do exhibit wonky behavior (like sometimes inferring a non-zero fill value) maybe we should just address those discrepancies as straightforwardly as possible. For example, for softmax we could just add a line saying the function conceptually treats unspecified values as negative infinity, and not as zeros. |
|
FYI, I am in a process of rewriting sparse.rst based on @mruberry feedback. |
|
Please feel free to re-request for review once you're done working on this. |
Summary: Fixes #45113 Description: - Fixed bug in sspaddmm by calling contiguous on indices. - Added tests We have to make indices contiguous as we use `indices.data_ptr` in `_to_csr` which assumes row-contiguous storage: https://github.com/pytorch/pytorch/blob/be45c3401af8186f97f0e2b269ff3bafaf16157f/aten/src/ATen/native/sparse/SparseTensorMath.cpp#L1087-L1090 > Part 1 of fixing this is probably to document sspaddmm. Part 2 may be to rewrite it using other ops. (#45113 (comment)) - Docs will be written here: #45400 Pull Request resolved: #45963 Reviewed By: malfet Differential Revision: D24335599 Pulled By: ngimel fbshipit-source-id: 8278c73a1b4cccc5e22c6f3818dd222588c46b45
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 a great, significant improvement to our sparse documentation. Thank you for taking the time to develop these docs, @pearu! Writing is hard and time consuming.
There are still a few grammatical issues and rough edges, but I think those are best addressed going forward.
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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Fixes #44635.