Skip to content

Commit

Permalink
[Example][Bugfix] Bugfix for dgi example (dmlc#4201)
Browse files Browse the repository at this point in the history
  • Loading branch information
chang-l authored Jul 2, 2022
1 parent dcf1699 commit 0f0e7c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/pytorch/dgi/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl import DGLGraph
from dgl.data import register_data_args, load_data
from dgi import DGI, Classifier
Expand Down Expand Up @@ -49,8 +50,8 @@ def main(args):

# add self loop
if args.self_loop:
g.remove_edges_from(nx.selfloop_edges(g))
g.add_edges_from(zip(g.nodes(), g.nodes()))
g = dgl.remove_self_loop(g)
g = dgl.add_self_loop(g)
n_edges = g.number_of_edges()

if args.gpu >= 0:
Expand Down

0 comments on commit 0f0e7c7

Please sign in to comment.