Skip to content

Conversation

@EdisonLeeeee
Copy link
Contributor

@EdisonLeeeee EdisonLeeeee commented Nov 18, 2022

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.

@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #6003 (26dc1de) into master (009abc2) will decrease coverage by 1.96%.
The diff coverage is 63.15%.

❗ Current head 26dc1de differs from pull request most recent head 904e7db. Consider uploading reports for the commit 904e7db to get more accurate results

@@            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     
Impacted Files Coverage Δ
torch_geometric/utils/sparse.py 75.86% <53.33%> (-24.14%) ⬇️
torch_geometric/nn/conv/message_passing.py 98.91% <100.00%> (-0.02%) ⬇️
torch_geometric/utils/spmm.py 88.88% <100.00%> (ø)
torch_geometric/nn/models/dimenet_utils.py 0.00% <0.00%> (-75.52%) ⬇️
torch_geometric/nn/models/dimenet.py 14.90% <0.00%> (-52.76%) ⬇️
torch_geometric/profile/profile.py 36.73% <0.00%> (-27.56%) ⬇️
torch_geometric/nn/conv/utils/typing.py 81.25% <0.00%> (-17.50%) ⬇️
torch_geometric/nn/pool/asap.py 92.10% <0.00%> (-7.90%) ⬇️
torch_geometric/nn/inits.py 67.85% <0.00%> (-7.15%) ⬇️
torch_geometric/nn/dense/linear.py 87.40% <0.00%> (-5.93%) ⬇️
... and 15 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@rusty1s rusty1s left a 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?

@EdisonLeeeee
Copy link
Contributor Author

Yep, will finish it tomorrow.

@github-actions github-actions bot added the nn label Nov 19, 2022
@EdisonLeeeee EdisonLeeeee requested a review from rusty1s November 19, 2022 03:36
@rusty1s rusty1s enabled auto-merge (squash) November 21, 2022 16:20
@rusty1s rusty1s merged commit 01037db into master Nov 21, 2022
@rusty1s rusty1s deleted the sparse branch November 21, 2022 19:09
jjpietrak pushed a commit to jjpietrak/pytorch_geometric that referenced this pull request Nov 25, 2022
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants