Skip to content

Conversation

@andreazanetti
Copy link
Contributor

@andreazanetti andreazanetti commented Mar 31, 2023

It provides support for SparseTensor data format for the trim_to_layer.py functionality.
The trimming function is isolated in a separate function, but still contained in trim_to_layer.py, as it is useful to that only.
Tests are included extending the test file used for trim_to_layer.py.
Some tests already present in a previous PR were slightly modified as to simulate a adj_t matrix that originates from a BFS traversal of a graph, starting the BFS traversal from the target node (assuming Batch Size = 1)

…o considered).

sage works on ogbn-products; gcn not yet
In the case of gcn data does not come always with rowptr/csr layout information in adj_t
Related tests are included. It provides significant speed up for CPU
workloads on homogenous graphs
@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Merging #7089 (a06feb8) into master (70cff06) will decrease coverage by 0.47%.
The diff coverage is 100.00%.

❗ Current head a06feb8 differs from pull request most recent head 74b4810. Consider uploading reports for the commit 74b4810 to get more accurate results

@@            Coverage Diff             @@
##           master    #7089      +/-   ##
==========================================
- Coverage   91.72%   91.26%   -0.47%     
==========================================
  Files         437      436       -1     
  Lines       23983    23949      -34     
==========================================
- Hits        21999    21857     -142     
- Misses       1984     2092     +108     
Impacted Files Coverage Δ
torch_geometric/utils/__init__.py 100.00% <100.00%> (ø)
torch_geometric/utils/trim_to_layer.py 100.00% <100.00%> (ø)

... and 30 files with indirect coverage changes

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

@andreazanetti
Copy link
Contributor Author

andreazanetti commented Apr 3, 2023

@rusty1s
with reference to the failing tests, I have some questions as it is not clear to me how we would like to manage the absence of torch_sparse in the requirements of PyG.

To my understanding, that absence generates issues with this contribution in a number of tests:
-docs/readthedocs.org:pytorch-geometric — Read the Docs build failed! it fails as torch_sparse is missing

the only one not impacted by the absence of torch_sparse is the changelog failure, which was however present also in other PRs recently merged... so I guess that should not be blocking for now.

How would you like me to go on?
Should I try to make the whole contribution conditional to the presence (=already installed) of torch_sparse in the user's env?
Thank you!!

@rusty1s
Copy link
Member

rusty1s commented Apr 3, 2023

You need to import from torch_geometric.typing for SparseTensor dependency, and any tests need to be gated behind @withPackage('torch_sparse'). Hope this clarifies your doubts.

@andreazanetti
Copy link
Contributor Author

You need to import from torch_geometric.typing for SparseTensor dependency, and any tests need to be gated behind @withPackage('torch_sparse'). Hope this clarifies your doubts.

Sure, it clarifies, thanks!

@andreazanetti andreazanetti marked this pull request as ready for review April 3, 2023 11:15
@rusty1s rusty1s changed the title Trim to layer sparse tensor SparseTensor support for trim_to_layer Apr 10, 2023
@rusty1s rusty1s enabled auto-merge (squash) April 10, 2023 09:33
@rusty1s rusty1s merged commit 2d8af8f into pyg-team:master Apr 10, 2023
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.

2 participants