Unverified Commit 35e5bca9 authored by Andrei Ivanov's avatar Andrei Ivanov Committed by GitHub
Browse files

Improving the MLP example. (#6593)

parent 3af61c6b
...@@ -99,6 +99,7 @@ def train( ...@@ -99,6 +99,7 @@ def train(
preds = torch.zeros(labels.shape[0], n_classes) preds = torch.zeros(labels.shape[0], n_classes)
with dataloader.enable_cpu_affinity():
for _input_nodes, output_nodes, subgraphs in dataloader: for _input_nodes, output_nodes, subgraphs in dataloader:
subgraphs = [b.to(device) for b in subgraphs] subgraphs = [b.to(device) for b in subgraphs]
new_train_idx = list(range(len(output_nodes))) new_train_idx = list(range(len(output_nodes)))
...@@ -143,6 +144,7 @@ def evaluate( ...@@ -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. eval_times = 1 # Due to the limitation of memory capacity, we calculate the average of logits 'eval_times' times.
for _ in range(eval_times): for _ in range(eval_times):
with dataloader.enable_cpu_affinity():
for _input_nodes, output_nodes, subgraphs in dataloader: for _input_nodes, output_nodes, subgraphs in dataloader:
subgraphs = [b.to(device) for b in subgraphs] subgraphs = [b.to(device) for b in subgraphs]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment