Skip to content

Commit

Permalink
Merge pull request Diego999#57 from AhMeDxHaMiDo/master
Browse files Browse the repository at this point in the history
Hey, I fixed an IndexError inside train.py that is faced by many people in the issues section.
  • Loading branch information
Diego999 committed Aug 15, 2021
2 parents b7b6886 + e469a6e commit 92ad7af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def compute_test():
loss_test = F.nll_loss(output[idx_test], labels[idx_test])
acc_test = accuracy(output[idx_test], labels[idx_test])
print("Test set results:",
"loss= {:.4f}".format(loss_test.data[0]),
"accuracy= {:.4f}".format(acc_test.data[0]))
"loss= {:.4f}".format(loss_test.data.item()),
"accuracy= {:.4f}".format(acc_test.data.item()))

# Train model
t_total = time.time()
Expand Down

0 comments on commit 92ad7af

Please sign in to comment.