Unverified Commit 2ae190d6 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

[Doc] fix shape mismatch problem in user guide (#2938)


Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent 527bbfa8
...@@ -110,7 +110,7 @@ computes loss. ...@@ -110,7 +110,7 @@ computes loss.
def compute_loss(pos_score, neg_score): def compute_loss(pos_score, neg_score):
# Margin loss # Margin loss
n_edges = pos_score.shape[0] n_edges = pos_score.shape[0]
return (1 - pos_score.unsqueeze(1) + neg_score.view(n_edges, -1)).clamp(min=0).mean() return (1 - pos_score + neg_score.view(n_edges, -1)).clamp(min=0).mean()
node_features = graph.ndata['feat'] node_features = graph.ndata['feat']
n_features = node_features.shape[1] n_features = node_features.shape[1]
...@@ -195,7 +195,7 @@ The training loop is similar to that of homogeneous graphs. ...@@ -195,7 +195,7 @@ The training loop is similar to that of homogeneous graphs.
def compute_loss(pos_score, neg_score): def compute_loss(pos_score, neg_score):
# Margin loss # Margin loss
n_edges = pos_score.shape[0] n_edges = pos_score.shape[0]
return (1 - pos_score.unsqueeze(1) + neg_score.view(n_edges, -1)).clamp(min=0).mean() return (1 - pos_score + neg_score.view(n_edges, -1)).clamp(min=0).mean()
k = 5 k = 5
model = Model(10, 20, 5, hetero_graph.etypes) model = Model(10, 20, 5, hetero_graph.etypes)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment