summaryrefslogtreecommitdiff
path: root/text_recognizer/models
diff options
context:
space:
mode:
Diffstat (limited to 'text_recognizer/models')
-rw-r--r--text_recognizer/models/util.py10
1 files changed, 0 insertions, 10 deletions
diff --git a/text_recognizer/models/util.py b/text_recognizer/models/util.py
deleted file mode 100644
index cc0df3c..0000000
--- a/text_recognizer/models/util.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from typing import Union
-
-from torch import Tensor
-
-
-def first_element(x: Tensor, element: Union[int, float], dim: int = 1) -> Tensor:
- nonz = x == element
- ind = ((nonz.cumsum(dim) == 1) & nonz).max(dim).indices
- ind[ind == 0] = x.shape[dim]
- return ind