Unverified Commit 0c3b2b78 authored by Andrei Ivanov's avatar Andrei Ivanov Committed by GitHub
Browse files

Improving the HARD_GAT example (#6036)


Co-authored-by: default avatarHongzhi (Steve), Chen <chenhongzhi.nkcs@gmail.com>
parent 885b0eae
......@@ -64,7 +64,7 @@ def main(args):
val_mask = g.ndata["val_mask"]
test_mask = g.ndata["test_mask"]
num_feats = features.shape[1]
n_classes = data.num_labels
n_classes = data.num_classes
n_edges = g.num_edges()
print(
"""----Data statistics------'
......@@ -115,7 +115,7 @@ def main(args):
)
# initialize graph
dur = []
mean = 0
for epoch in range(args.epochs):
model.train()
if epoch >= 3:
......@@ -129,8 +129,7 @@ def main(args):
optimizer.step()
if epoch >= 3:
dur.append(time.time() - t0)
mean = (mean * (epoch - 3) + (time.time() - t0)) / (epoch - 2)
train_acc = accuracy(logits[train_mask], labels[train_mask])
if args.fastmode:
......@@ -145,11 +144,11 @@ def main(args):
"Epoch {:05d} | Time(s) {:.4f} | Loss {:.4f} | TrainAcc {:.4f} |"
" ValAcc {:.4f} | ETputs(KTEPS) {:.2f}".format(
epoch,
np.mean(dur),
mean,
loss.item(),
train_acc,
val_acc,
n_edges / np.mean(dur) / 1000,
n_edges / mean / 1000,
)
)
......
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