Commit 7b6b5186 authored by YU Xiyue's avatar YU Xiyue
Browse files

5

parent 683c5b8d
Pipeline #722 failed with stages
in 0 seconds
......@@ -96,8 +96,9 @@ def test(model, test_loader, criterion):
output = model(data)
pred = output.argmax(dim=-1)
corr = (pred == target).sum()
accuracy = corr.item() / len(data)
num_correct += corr.item()
test_loss = criterion(output, target)
accuracy = num_correct / len(test_loader.dataset)
########################################################################
print("Test set: Average loss: {:.4f}\t Acc {:.2f}".format(test_loss.item(), accuracy))
......
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