Skip to content

Commit

Permalink
fix no in-degree destination nodes error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 16, 2023
1 parent 18074f6 commit 2a9117d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/graphstorm/model/hgt_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ def forward(self, g, h):
trans_out = trans_out * alpha + h[k] * (1-alpha)
else: # Nodes not really in destination side.
warnings.warn("Warning. Graph convolution returned empty "
f"dictionary, for node with type: {str(k)}")
# So add psudo self-loop with feature copy.
trans_out = self.drop(self.a_linears[k](h[k]))
trans_out = trans_out * alpha + h[k] * (1-alpha)
f"dictionary for node with type: {str(k)}. Pleaes check your data \
for no in-degree {str(k)} nodes.")
# So add psudo self-loop for the destination nodes with its own feature.
dst_h = h[k][:g.num_dst_nodes(k)]
trans_out = self.drop(self.a_linears[k](dst_h))
trans_out = trans_out * alpha + dst_h * (1-alpha)
else:
continue

Expand Down

0 comments on commit 2a9117d

Please sign in to comment.