pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.15k stars 3.64k forks source link

What about providing C++ API in pyg, like that in `pytorch_cluster` ? #1254

Open WMF1997 opened 4 years ago

WMF1997 commented 4 years ago

🚀 Feature

Providing C++ API, like that in pytorch_cluster, pytorch_scatter, pytorch_sparse, pytorch_spline_conv ?

Motivation

Graph convolution applications are gradually deployed in embedding devices. However, there might not be a proper . What's more, a training procedure with pytorch+pytorch_geometric can be done easily, but the training procedure with libtorch+libtorchgeometric does not exist.

"From Research To Production", the team provides PyTorch for research, and LibTorch for production. And since last year, GNN has been well developed in research area. Many new methods are proposed. And GNNs has been used in many applications. In my opinion, C++ API can make industrial deployment easier for some practical use.

Additional context

Perhaps this feature request is unrealistic, because as the project repositories shown, torch_geometric is much more like a front-end library which provides tools for research, and other 4 libraries (torch_cluster, torch_scatter, torch_sparse, torch_spline_conv) is the back-end libraries for the front-end. The researchers just know to write the proper Python code (pyg code), and do not need to concern C++/CUDA code. I know the reason why it only has Python code in pyg.

This is just my personal thought, and if other people think this is of no need, I will not mention that again.

Yours sincerely, @wmf1997

P.S. Another reason for this issue is that I want to write some examples for torch_cluster's C++ API. See this issue

rusty1s commented 4 years ago

Hi @WMF1997, I hope you are well.

We are currently working on jittable functionality (check the PRs), which was one of the main reasons to introduce the C++ library in the extensions in the first place. While a C++ API for PyG might be useful, I currently feel that libtorchgeometric might be out of the scope for this package at the moment. I think one of the main strengths of PyG is that it mostly relies on PyTorch/Python code, and that it's therefore easy-understandable and extandable to a lot of our users.

WMF1997 commented 4 years ago

Yes, you are right, PyG's strength is PyTorch/Python for research, but not LibTorch/C++ for production.

rusty1s commented 4 years ago

I think we can talk about it more in July/August when I have finished all my current ToDos regarding PyG. Does that work for you?

WMF1997 commented 4 years ago

Emm... I think in July and August, ... Maybe I do not have enough time then. And I am not so familiar with C/C++ code.

liaopeiyuan commented 4 years ago

Hi @rusty1s , I've been focusing on deploying graph neural networks in edge computing applications and production environment, so I maybe able to help with designing a C++ api for the package. I'm also familiar with PyTorch C++ API. I believe that maintaining a libtorchgeometric in parallel with the current PyTorch+Python api would be awesome and facilitate a lot in applying graph neural networks in industrial scenarios. You are always welcome to contact me about your ideas around July/August, and before then I will be mainly working on JIT support in Python.

rusty1s commented 4 years ago

Awesome! Thanks for all your help. Let's first make JIT work :)