-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 is_sparse
and to_torch_coo_tensor
#6003
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6003 +/- ##
==========================================
- Coverage 86.64% 84.67% -1.97%
==========================================
Files 361 360 -1
Lines 19860 19860
==========================================
- Hits 17207 16816 -391
- Misses 2653 3044 +391
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 besides the missing test of to_sparse_coo_tensor
. Do you plan to integrate that in this PR?
Yep, will finish it tomorrow. |
This PR aims to + Add `is_sparse` to check if the input is either `torch.sparse.Tensor` or `torch_sparse.SparseTensor` + Add `to_torch_coo_tensor` to convert `edge_index` and `edge_weight` to `torch.sparse.Tensor` (in COO format) + Move `is_torch_sparse_tensor` from `torch_sparse_tensor.py` to `sparse.py`. I think this makes the structure in `torch_geometric.utils` clearer. + Clean up duplicated code in `message_passing.py`. Co-authored-by: rusty1s <matthias.fey@tu-dortmund.de>
This PR aims to
is_sparse
to check if the input is eithertorch.sparse.Tensor
ortorch_sparse.SparseTensor
to_torch_coo_tensor
to convertedge_index
andedge_weight
totorch.sparse.Tensor
(in COO format)is_torch_sparse_tensor
fromtorch_sparse_tensor.py
tosparse.py
. I think this makes the structure intorch_geometric.utils
clearer.message_passing.py
.