Skip to content
Discussion options

You must be logged in to vote

Hi,
it would probably be best if you take a look here for a well detailed example on how to structure your data for Pytorch Geometric.
In a nutshell, your features are just a torch.tensor with shape (num_nodes, num_features). In your case:

x = torch.tensor([[1, 0, 0, 1, 1, 0, 0, 0], 
                  [2, 0, 1, 0, 0, 0, 1, 0]], dtype=torch.long)

As for your edge_list (what you call connection relationship), that's another torch.tensor of shape (2, num_edges). If you're working with an undirected graph, the index should report both directions. Like so:

edge_attr = torch.tensor([[1, 0],
                          [0, 1], 
                          [2, 0],
                          [0, 2],   …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rusty1s
Comment options

@jianchaoji
Comment options

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