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
35e5bca9
Unverified
Commit
35e5bca9
authored
Nov 21, 2023
by
Andrei Ivanov
Committed by
GitHub
Nov 22, 2023
Browse files
Improving the MLP example. (#6593)
parent
3af61c6b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
examples/pytorch/ogb/ogbn-products/mlp/mlp.py
examples/pytorch/ogb/ogbn-products/mlp/mlp.py
+20
-18
No files found.
examples/pytorch/ogb/ogbn-products/mlp/mlp.py
View file @
35e5bca9
...
...
@@ -99,6 +99,7 @@ def train(
preds
=
torch
.
zeros
(
labels
.
shape
[
0
],
n_classes
)
with
dataloader
.
enable_cpu_affinity
():
for
_input_nodes
,
output_nodes
,
subgraphs
in
dataloader
:
subgraphs
=
[
b
.
to
(
device
)
for
b
in
subgraphs
]
new_train_idx
=
list
(
range
(
len
(
output_nodes
)))
...
...
@@ -143,6 +144,7 @@ def evaluate(
eval_times
=
1
# Due to the limitation of memory capacity, we calculate the average of logits 'eval_times' times.
for
_
in
range
(
eval_times
):
with
dataloader
.
enable_cpu_affinity
():
for
_input_nodes
,
output_nodes
,
subgraphs
in
dataloader
:
subgraphs
=
[
b
.
to
(
device
)
for
b
in
subgraphs
]
...
...
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