-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Remove setting coalesce to 0 in sparse transpose_ #4707
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
Nice catch! |
should you also change THCSTensor ? |
@pytorchbot retest this please |
Can you add a unit test for this behavior? |
@pytorchbot retest this please |
1 similar comment
@pytorchbot retest this please |
This is incorrect. |
…iants (#10496) Summary: - fixes #6219 - removed invariants at #4707 - assume a sparse tensor with coalesced=true when: 1. its elements are unique and 2. the indices are in sorted order Pull Request resolved: #10496 Differential Revision: D9311214 Pulled By: weiyangfb fbshipit-source-id: 167fa5a8e9e5f9c800db02f728a1194029f7e4f3
…iants (#10496) Summary: - fixes pytorch/pytorch#6219 - removed invariants at pytorch/pytorch#4707 - assume a sparse tensor with coalesced=true when: 1. its elements are unique and 2. the indices are in sorted order Pull Request resolved: pytorch/pytorch#10496 Differential Revision: D9311214 Pulled By: weiyangfb fbshipit-source-id: 167fa5a8e9e5f9c800db02f728a1194029f7e4f3
…iants (pytorch#10496) Summary: - fixes pytorch#6219 - removed invariants at pytorch#4707 - assume a sparse tensor with coalesced=true when: 1. its elements are unique and 2. the indices are in sorted order Pull Request resolved: pytorch#10496 Differential Revision: D9311214 Pulled By: weiyangfb fbshipit-source-id: 167fa5a8e9e5f9c800db02f728a1194029f7e4f3
coalesced
means that the sparse tensor'sindices
are all unique.Let's say we transpose a sparse tensor in dimensions
d0, d1
. Let's say each index is somex_i = (y_1, y_2, ..., y_n)
wheren
is the total number of dimensions of the sparse tensor. Transposing the sparse tensor in place is equivalent to swappingy_{d0}, y_{d1}
for all indicesx_i
.If all the indices were unique before, then they will be unique after. If they were non-unique before, they will be non-unique after.
This change removes setting
coalesced
to 0 after every transpose. In practice it doesn't affect very much but it's good for correctness.Test Plan
run tests