Skip to content
Discussion options

You must be logged in to vote

That is actually quite simple in PyG as well:

x = ...  # Node feature matrix: [num_nodes, num_features]
edge_index = ... # Edge indices: [2, num_edges]

src, dst = edge_index
score = (x[src] * x[dst]).sum(dim=-1)

loss = F.cross_entropy(score, data.edge_label)  # Classification
loss = F.mse_loss(score, data.edge_value)  # Regression

Replies: 2 comments 9 replies

Comment options

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

@michalisfrangos
Comment options

Answer selected by antoni4040
Comment options

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

@michalisfrangos
Comment options

@rusty1s
Comment options

@michalisfrangos
Comment options

@vikasbammidi
Comment options

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