Unverified Commit 9c241d83 authored by caojy1998's avatar caojy1998 Committed by GitHub
Browse files

[Examples] Modify the output of examples for benchmark test (#6692)


Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-21-37.ap-northeast-1.compute.internal>
parent 37fde7ed
......@@ -19,6 +19,7 @@ main
└───> Evaluate the model
"""
import argparse
import time
import dgl.nn as dglnn
......@@ -68,15 +69,18 @@ def train(g, features, labels, masks, model):
# Training loop.
for epoch in range(200):
t0 = time.time()
model.train()
logits = model(g, features)
loss = loss_fcn(logits[train_mask], labels[train_mask])
optimizer.zero_grad()
loss.backward()
optimizer.step()
t1 = time.time()
acc = evaluate(g, features, labels, val_mask, model)
print(
f"Epoch {epoch:05d} | Loss {loss.item():.4f} | Accuracy {acc:.4f} "
f"Epoch {epoch:05d} | Loss {loss.item():.4f} | Accuracy {acc:.4f} | "
f"Time {t1 - t0:.4f}"
)
......
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