MPNN edge features

I am reading the documentation here for the MPNN. It says that the edge features should be of shape (N, *) where * is the input dim to the function used on the edge features. Previously it is said that node features should also be of shape (N, D_in), so I assumed that N would be the number of nodes, but that wouldn’t make sense for the shape of the edge features. Is the N in the edge features shape the number of edges we have?

Also, how do I set up my edge feature tensor? what do I want the rows to be? I’m assuming order matters somewhere e.g. the first row should be for the edge feature of the node 0 to its first neighbour? is there documentation for this anywhere?

Is the N in the edge features shape the number of edges we have?

I think this is an abuse of notation and N here is a “local variable”. For node features, N is the number of nodes. For edge features, N is the number of edges.

Also, how do I set up my edge feature tensor? what do I want the rows to be? I’m assuming order matters somewhere e.g. the first row should be for the edge feature of the node 0 to its first neighbour? is there documentation for this anywhere?

The i-th row should contain the feature for the i-th edge. To figure out edge ids, see edges and edge_ids.

1 Like

just to double check that I’m not being stupid, I called g.edges() on my small graph. It returned the tuple (tensor([0, 1, 2, 3, 2, 5]), tensor([1, 2, 3, 4, 0, 3])) – this means that my edge feature tensor should have the first row being the edge feature for the edge going from node 0 to node 1, second row should be edge feature going from node 1 to node 2, etc. ?

just to double check that I’m not being stupid, I called g.edges() on my small graph. It returned the tuple (tensor([0, 1, 2, 3, 2, 5]), tensor([1, 2, 3, 4, 0, 3])) – this means that my edge feature tensor should have the first row being the edge feature for the edge going from node 0 to node 1, second row should be edge feature going from node 1 to node 2, etc. ?

Correct.

1 Like

The issue should be fixed in this PR.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.