Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions b/python/dgl/data/gindt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
self.graphs.append(g)
self.labels = F.tensor(self.labels, F.int64)
# if no attr
if not self.nattrs_flag:
if self.verbose:
g.ndata["attr"] = F.tensor(nattrs, F.float32)
self.nattrs_flag = True
g.ndata["label"] = F.tensor(nlabels, F.int64)
if len(self.nlabel_dict) > 1:
self.nlabels_flag = True
if tmp == len(nrow):
# no node attributes
nrow = [int(w) for w in nrow]
elif tmp < len(nrow):
# has node attributes
nrow = [int(w) for w in nrow[:tmp]]
nattr = [float(w) for w in nrow[tmp:]]
nattrs.append(nattr)
7 changes: 4 additions & 3 deletions python/dgl/data/gindt.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def process(self):
if tmp == len(nrow):
# no node attributes
nrow = [int(w) for w in nrow]
elif tmp > len(nrow):
elif tmp < len(nrow):
# has node attributes
nrow = [int(w) for w in nrow[:tmp]]
nattr = [float(w) for w in nrow[tmp:]]
nattrs.append(nattr)
Expand Down Expand Up @@ -257,7 +258,7 @@ def process(self):
g.ndata["attr"] = F.tensor(nattrs, F.float32)
self.nattrs_flag = True

g.ndata["label"] = F.tensor(nlabels)
g.ndata["label"] = F.tensor(nlabels, F.int64)
if len(self.nlabel_dict) > 1:
self.nlabels_flag = True

Expand All @@ -269,7 +270,7 @@ def process(self):

self.graphs.append(g)

self.labels = F.tensor(self.labels)
self.labels = F.tensor(self.labels, F.int64)
# if no attr
if not self.nattrs_flag:
if self.verbose:
Expand Down