question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to update edge embeddings?

See original GitHub issue

❓ Questions & Help

Hi, I have a question about how to update node embeddings and edge embeddings simultaneously. I want to update the edge embeddings for the next update of node embeddings and the edge embedding $e_{ij}^{l+1}$ is updated with the information of $x_i^l, x_j^l, e_{ij}^l$. I think it should be finished in message method, but it should only return a Tensor. Are there some examples? Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
rusty1scommented, Feb 19, 2021

This is correct, although I suggest to apply edge_mlp in message:

class processor(MessagePassing):

    def __init__(self):
        super(processor, self).__init__(aggr='add')
    
    ...

    def forward(self, x, edge_index, edge_attr):
        return self.propagate(edge_index, x=x, edge_attr=edge_attr), edge_attr

    def message(self, x_i, x_j, edge_attr):
        return self.edge_mlp(torch.cat([x_i, edge_attr, x_j], dim=-1)

    def update(self, inputs, x):
        return self.node_mlp(torch.cat([x, inputs], dim=-1)
1reaction
rusty1scommented, Feb 22, 2021

That’s not possible since you can only integrate one-dimensional edge features into a sparse matrix multiplication (that act as a weighting of neighbors). In this case, this needs to be implemented like the way above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to update edge features in a graph using a loss function?
Embed the subgraph (preferably using a GNN) and obtain it's embedding and use it with a classifier to predict say f1/f2. Propagate the...
Read more >
How to use edge features in Graph Neural Networks (and ...
In this video I talk about edge weights, edge types and edge features and how to include them in Graph Neural Networks.
Read more >
Graph Neural Networks for Updating Node/Edge ...
All models based on graph neural networks start with updating node/edge representations. ... feats (int) – Size for the node and edge embeddings...
Read more >
Edge Embedding Not updated by Every GNN Layer #1122
The GNN Layers return node embedding and edge embedding . But the edge_embedding is ... Updating edge-embeddings after each GNN layer #1134.
Read more >
Learning and Updating Node Embedding on Dynamic ...
Embedding (DyHINE), which can update embeddings when the network evolves. ... nodes (edge type, neighbor embedding) are used to update their embedding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found