Replies: 1 comment
-
I looked at the source code at torch_geometric nn pool radius_graph and the cuda kernel It seems there's no nearest neighbor selection while choosing the I have now used def radiusGraphNearest(self):
def f(x, batch, r, loop, max_num_neighbors):
edge_index = knn_graph(x, k=max_num_neighbors, batch=batch, loop=loop)
row, col = edge_index
distances = (x[col] - x[row]).norm(dim=1)
mask = distances <= r
final_edge_index = edge_index[:, mask]
return final_edge_index
return f Maybe someone (@rusty1s ?) can confirm whether this function is indeed effective without any side-effects |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I use
radius_graph
in my pointcloud data and try to get all neighbours(by specifying a large number likeint(1e6)
tomax_num_neighbors
) in that specified radius, say20.
, I sometimes run out of memory.So, I want to know if it is possible to use
radius_graph
from torch_geometric, with radius say20.
, and specify the parametermax_num_neighbors
, eg100
, and make sure that they are the nearest ones? Some of the nodes in a graph might have less than 100 neighbours like35
,55
,10
, and some might have more than100
neighbours, like200
,300
. For the less than100
, I want all the neighbours and for more than100
, I want the100
nearest.Beta Was this translation helpful? Give feedback.
All reactions