summaryrefslogtreecommitdiff
path: root/src/text_recognizer/models/util.py
diff options
context:
space:
mode:
authoraktersnurra <gustaf.rydholm@gmail.com>2020-07-05 22:27:08 +0200
committeraktersnurra <gustaf.rydholm@gmail.com>2020-07-05 22:27:08 +0200
commit5a78fc2e33c28968a69d033cb10d638f4f63fed1 (patch)
treee11cea8366c848e5500f85968ee5369ff8d96b00 /src/text_recognizer/models/util.py
parent7c4de6d88664d2ea1b084f316a11896dde3e1150 (diff)
Working on getting experiment loop.
Diffstat (limited to 'src/text_recognizer/models/util.py')
-rw-r--r--src/text_recognizer/models/util.py19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/text_recognizer/models/util.py b/src/text_recognizer/models/util.py
deleted file mode 100644
index 905fe7b..0000000
--- a/src/text_recognizer/models/util.py
+++ /dev/null
@@ -1,19 +0,0 @@
-"""Utility functions for models."""
-
-import torch
-
-
-def accuracy(outputs: torch.Tensor, labels: torch.Tensro) -> float:
- """Short summary.
-
- Args:
- outputs (torch.Tensor): The output from the network.
- labels (torch.Tensor): Ground truth labels.
-
- Returns:
- float: The accuracy for the batch.
-
- """
- _, predicted = torch.max(outputs.data, dim=1)
- acc = (predicted == labels).sum().item() / labels.shape[0]
- return acc