Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
0f0e7c7f
Unverified
Commit
0f0e7c7f
authored
Jul 01, 2022
by
Chang Liu
Committed by
GitHub
Jul 02, 2022
Browse files
[Example][Bugfix] Bugfix for dgi example (#4201)
parent
dcf16992
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
examples/pytorch/dgi/train.py
examples/pytorch/dgi/train.py
+3
-2
No files found.
examples/pytorch/dgi/train.py
View file @
0f0e7c7f
...
@@ -4,6 +4,7 @@ import networkx as nx
...
@@ -4,6 +4,7 @@ import networkx as nx
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch.nn.functional
as
F
import
torch.nn.functional
as
F
import
dgl
from
dgl
import
DGLGraph
from
dgl
import
DGLGraph
from
dgl.data
import
register_data_args
,
load_data
from
dgl.data
import
register_data_args
,
load_data
from
dgi
import
DGI
,
Classifier
from
dgi
import
DGI
,
Classifier
...
@@ -49,8 +50,8 @@ def main(args):
...
@@ -49,8 +50,8 @@ def main(args):
# add self loop
# add self loop
if
args
.
self_loop
:
if
args
.
self_loop
:
g
.
remove_
edges_from
(
nx
.
selfloop
_edges
(
g
)
)
g
=
dgl
.
remove_self
_
loop
(
g
)
g
.
add_edges_from
(
zip
(
g
.
nodes
(),
g
.
nodes
())
)
g
=
dgl
.
add_self_loop
(
g
)
n_edges
=
g
.
number_of_edges
()
n_edges
=
g
.
number_of_edges
()
if
args
.
gpu
>=
0
:
if
args
.
gpu
>=
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment