-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Improve error messages of torch.testing.assert_close for sparse inputs
#61583
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
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 578dd5d (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
@cpuhrsch @IvanYashchuk - want to take a look at this? |
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.
New error messages look great!
A few questions on comparison functions:
_check_sparse_coo_members_individuallychecks uncoalesced values and indices. There could be a situation when different uncoalesced sparse COO tensors would be equal when coalesced (sparse.coalesce()). Maybe it would be useful to have a possibility to test that?_check_sparse_csr_members_individuallydoesn't check_nnz(), while comparison for COO tensors does that, should it be added here? If all further indices and values checks pass,nnzshould not be different though.
Not sure I fully understand. We have a pytorch/torch/testing/_asserts.py Lines 238 to 241 in 9496521
If you disable this check, both tensors will be pytorch/torch/testing/_asserts.py Lines 283 to 285 in 9496521
Discussion for COO in #58844 (comment). If it is useful, I'm fine with adding it to CSR as well. cc @pearu |
Thanks! I didn't know about it. |
|
@cpuhrsch did you want to take a look at this? |
|
@cpuhrsch has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This utilizes the feature introduced in #60091 to modify the header of the error message.
Before:
After: