diff --git a/b/python/dgl/data/gindt.py b/b/python/dgl/data/gindt.py new file mode 100644 index 000000000000..9f22c889fc20 --- /dev/null +++ b/b/python/dgl/data/gindt.py @@ -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) diff --git a/python/dgl/data/gindt.py b/python/dgl/data/gindt.py index cae9a461a102..8b47bbf9fd6c 100644 --- a/python/dgl/data/gindt.py +++ b/python/dgl/data/gindt.py @@ -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) @@ -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 @@ -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: