Skip to content
Snippets Groups Projects
Commit 9c1786d0 authored by Yifan Zhao's avatar Yifan Zhao
Browse files

Measure accuracy in percentages

parent f935e7ab
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,4 @@ from torch import Tensor
def accuracy(output: Tensor, target: Tensor) -> float:
_, pred_labels = output.max(1)
n_correct = (pred_labels == target).sum().item()
return n_correct / len(output)
return n_correct / len(output) * 100
......@@ -44,7 +44,7 @@ class TestTorchApp(unittest.TestCase):
def test_baseline_qos(self):
app = self.get_app()
qos, _ = app.measure_qos_perf({}, False)
self.assertAlmostEqual(qos, 0.88)
self.assertAlmostEqual(qos, 88.0)
def test_tuning(self):
app = TorchApp(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment