-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEA] pytorch geometric interface #1200
Comments
@jannessm great question. I need to dive into pytorch format before fully answering the questions. The roadmap is currently Pandas and CuPy this year. |
Hi @jannessm, I am working with PyTorch-Geometric (PyG) and for the moment I'm using the following solution (only regards PyG to cuGraph for the moment). Maybe it can be of some help. from torch.utils.dlpack import from_dlpack, to_dlpack
from torch_geometric.data import Data
from torch_geometric.utils import add_self_loops
import cudf
import cugraph as cx
def to_cugraph(data: Data):
edge_index, weights = add_self_loops(data.edge_index, data.edge_attr, num_nodes=data.num_nodes)
df = edge_index.contiguous().t().clone().detach()
df = cudf.from_dlpack(to_dlpack(df))
if weights is not None:
weights = weights.contiguous().view(-1).clone().detach()
df[2] = cudf.from_dlpack(to_dlpack(weights))
return cx.from_cudf_edgelist(df, source=0, destination=1,
edge_attr=2 if df.shape[1] == 3 else None,
renumber=False) Adding self loops is needed to handle the issue #1206 I opened a while ago. @BradReesWork the conversion cuDF/PyTorch seem to work using DLPack, but we need to take care of some details, like the row-major format and the case in which a tensor is non-contiguous. Anyway, probably the conversion from and to PyG should be done from the PyG side (paging @rusty1s :)). Regards, |
This issue has been labeled |
This issue can likely be closed. I will work on |
Sure, I will make a PR in a week or so! |
This issue has been labeled |
I am currently using Pytorch geometric for deep learning on graphs. It supports way more convolutions than DGL. So I was wondering if there is a plan to support an interface of converting graphs to a cugraph graph and vice versa.
Regards.
The text was updated successfully, but these errors were encountered: