pytorch_geometric
pytorch_geometric copied to clipboard
Support multiple node type sampling in NeighborLoader (V2)
This PR adds functionality to allow for multiple node types to be sampled in NeighbourLoader.
The interface looks as was discussed in the roadmap (https://github.com/pyg-team/pytorch_geometric/issues/4765):
NeighbourLoader(
input_nodes=dict(
paper=torch.LongTensor([0,1,2]),
author=torch.LongTensor([0,1,2])
)
...
)
Internally, it converts this to a list of tuples.
[('paper', 0), ('paper', 1),....]
This is not very efficient, but benchmarks https://github.com/pyg-team/pytorch_geometric/issues/4765#issuecomment-1147105584 showed it to be acceptable.
TODO:
- [ ] Add tests
Addresses https://github.com/pyg-team/pytorch_geometric/issues/4765
cc @mananshah99
@mananshah99 I was trying to figure out how to cleanly add this, and the easiest seemed to be to do something like what I've done here: Wrapping the 'input nodes' up into a class.
I know the code is probably not in the right place, and I've not actually used it to support multiple nodes yet, but I wanted to get feedback on this approach.
Sorry, just saw this in my inbox. Will have a review in shortly
hey just a bump @mananshah99 :-)
I'll try to get this merged today. Sorry for the slowness on our end :)
thanks! but actually its no where near ready for merging - just looking for feedback on the approach before I implement it more thoroughly
Your understanding is correct. Thanks for the feedback.
I will finish the implementation taking your comments into account 👍
Your understanding is correct. Thanks for the feedback.
I will finish the implementation taking your comments into account 👍
Hi @Padarn, thanks for your contributioooon!! Would you still be interested on finishing it? It would be amazing to have this feature