"git@developer.sourcefind.cn:OpenDAS/fairseq.git" did not exist on "5ecedd696acbedcf5c843caba784c08ecf4e8f66"
Unverified Commit 02850212 authored by Mohammad Amin Khashkhashi Moghaddam's avatar Mohammad Amin Khashkhashi Moghaddam Committed by GitHub
Browse files

Fix bug in GIN Dataset degree OHE logic (#1498)

In the previous code, the same vector was being assigned to all the nodes in each graph.
`:` was used incorrectly assuming that only one row will be selected for each column but all rows were selected for each column.
parent 1af0d806
...@@ -237,7 +237,7 @@ class GINDataset(object): ...@@ -237,7 +237,7 @@ class GINDataset(object):
for g in self.graphs: for g in self.graphs:
g.ndata['attr'] = np.zeros(( g.ndata['attr'] = np.zeros((
g.number_of_nodes(), len(label2idx))) g.number_of_nodes(), len(label2idx)))
g.ndata['attr'][:, [label2idx[F.as_scalar(nl)] for nl in g.ndata['label']]] = 1 g.ndata['attr'][range(g.number_of_nodes()), [label2idx[F.as_scalar(nl)] for nl in g.ndata['label']]] = 1
# after load, get the #classes and #dim # after load, get the #classes and #dim
self.gclasses = len(self.glabel_dict) self.gclasses = len(self.glabel_dict)
......
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