pytorch_cluster icon indicating copy to clipboard operation
pytorch_cluster copied to clipboard

Enable returning distances from knn and knn_graph

Open chenzhekl opened this issue 3 years ago • 6 comments

TL;DR Add a switch for knn and knn_graph to enable returning distances alongside the edge_index.

This code has been tested on CPU and CUDA 11.3 with PyTorch 1.11.0 on Ubuntu 18.04.

Related: pyg-team/pytorch_geometric#3010


I still cannot directly decorate knn and knn_graph with @torch.jit.script per your suggestions (https://github.com/pyg-team/pytorch_geometric/issues/3010#issuecomment-1166582712). So I took a slightly different approach which was similar to https://github.com/pytorch/pytorch/issues/37986. Though @torch.jit.script has to be removed from the above two functions, the code that uses those two functions can be correctly jitted. Is it OK with you? @rusty1s

chenzhekl avatar Jun 27 '22 05:06 chenzhekl

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (dbcafbe) 100.00% compared to head (a6a5aca) 100.00%. Report is 23 commits behind head on master.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #133   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines           77       116   +39     
=========================================
+ Hits            77       116   +39     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 27 '22 05:06 codecov-commenter

This pull request had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity.

github-actions[bot] avatar Dec 25 '22 01:12 github-actions[bot]

This pull request had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity.

github-actions[bot] avatar Jun 24 '23 01:06 github-actions[bot]

This pull request had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity.

github-actions[bot] avatar Jan 06 '24 00:01 github-actions[bot]