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
158b0fcd
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "089252542c0fff6d8753b67a41e1161a62be3946"
Unverified
Commit
158b0fcd
authored
Aug 02, 2023
by
Andrei Ivanov
Committed by
GitHub
Aug 03, 2023
Browse files
Improving the citation_network example. (#6032)
parent
61b2f4e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
examples/pytorch/model_zoo/citation_network/run.py
examples/pytorch/model_zoo/citation_network/run.py
+13
-14
No files found.
examples/pytorch/model_zoo/citation_network/run.py
View file @
158b0fcd
...
@@ -61,7 +61,7 @@ def main(args):
...
@@ -61,7 +61,7 @@ def main(args):
val_mask
=
g
.
ndata
[
"val_mask"
]
val_mask
=
g
.
ndata
[
"val_mask"
]
test_mask
=
g
.
ndata
[
"test_mask"
]
test_mask
=
g
.
ndata
[
"test_mask"
]
in_feats
=
features
.
shape
[
1
]
in_feats
=
features
.
shape
[
1
]
n_classes
=
data
.
num_la
bel
s
n_classes
=
data
.
num_
c
la
sse
s
n_edges
=
g
.
num_edges
()
n_edges
=
g
.
num_edges
()
print
(
print
(
"""----Data statistics------'
"""----Data statistics------'
...
@@ -108,7 +108,7 @@ def main(args):
...
@@ -108,7 +108,7 @@ def main(args):
)
)
# initialize graph
# initialize graph
dur
=
[]
mean
=
0
for
epoch
in
range
(
200
):
for
epoch
in
range
(
200
):
model
.
train
()
model
.
train
()
if
epoch
>=
3
:
if
epoch
>=
3
:
...
@@ -122,17 +122,16 @@ def main(args):
...
@@ -122,17 +122,16 @@ def main(args):
optimizer
.
step
()
optimizer
.
step
()
if
epoch
>=
3
:
if
epoch
>=
3
:
dur
.
append
(
time
.
time
()
-
t0
)
mean
=
(
mean
*
(
epoch
-
3
)
+
(
time
.
time
()
-
t0
))
/
(
epoch
-
2
)
acc
=
evaluate
(
model
,
features
,
labels
,
val_mask
)
acc
=
evaluate
(
model
,
features
,
labels
,
val_mask
)
print
(
print
(
"Epoch {:05d} | Time(s) {:.4f} | Loss {:.4f} | Accuracy {:.4f} | "
"Epoch {:05d} | Time(s) {:.4f} | Loss {:.4f} | Accuracy {:.4f} | "
"ETputs(KTEPS) {:.2f}"
.
format
(
"ETputs(KTEPS) {:.2f}"
.
format
(
epoch
,
epoch
,
np
.
mean
(
dur
)
,
mean
,
loss
.
item
(),
loss
.
item
(),
acc
,
acc
,
n_edges
/
np
.
mean
(
dur
)
/
1000
,
n_edges
/
mean
/
1000
,
)
)
)
)
...
...
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