Skip to content
Discussion options

You must be logged in to vote

Yes, reshaping only works in case of more than k nodes in the graph.

One way to fix this is to utilize to_dense_batch (untested):

row, col = knn(...)
row = torch.arange(num_nodes).view(-1, 1).repeat(1, k).view(-1)

col, mask = to_dense_batch(col, batch=row, fill_value=-1)

Let me know if this works for you!

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@fmocking
Comment options

@rusty1s
Comment options

@fmocking
Comment options

Answer selected by fmocking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants