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
2584f3af
Unverified
Commit
2584f3af
authored
Aug 02, 2023
by
Andrei Ivanov
Committed by
GitHub
Aug 03, 2023
Browse files
Improving the HGT example. (#6069)
parent
ee651811
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
examples/pytorch/hgt/train_acm.py
examples/pytorch/hgt/train_acm.py
+1
-3
No files found.
examples/pytorch/hgt/train_acm.py
View file @
2584f3af
...
@@ -49,7 +49,6 @@ def get_n_params(model):
...
@@ -49,7 +49,6 @@ def get_n_params(model):
def
train
(
model
,
G
):
def
train
(
model
,
G
):
best_val_acc
=
torch
.
tensor
(
0
)
best_val_acc
=
torch
.
tensor
(
0
)
best_test_acc
=
torch
.
tensor
(
0
)
best_test_acc
=
torch
.
tensor
(
0
)
train_step
=
torch
.
tensor
(
0
)
for
epoch
in
np
.
arange
(
args
.
n_epoch
)
+
1
:
for
epoch
in
np
.
arange
(
args
.
n_epoch
)
+
1
:
model
.
train
()
model
.
train
()
logits
=
model
(
G
,
"paper"
)
logits
=
model
(
G
,
"paper"
)
...
@@ -59,8 +58,7 @@ def train(model, G):
...
@@ -59,8 +58,7 @@ def train(model, G):
loss
.
backward
()
loss
.
backward
()
torch
.
nn
.
utils
.
clip_grad_norm_
(
model
.
parameters
(),
args
.
clip
)
torch
.
nn
.
utils
.
clip_grad_norm_
(
model
.
parameters
(),
args
.
clip
)
optimizer
.
step
()
optimizer
.
step
()
train_step
+=
1
scheduler
.
step
()
scheduler
.
step
(
train_step
)
if
epoch
%
5
==
0
:
if
epoch
%
5
==
0
:
model
.
eval
()
model
.
eval
()
logits
=
model
(
G
,
"paper"
)
logits
=
model
(
G
,
"paper"
)
...
...
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