summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-22 22:39:11 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-22 22:39:11 +0100
commitb3532a4cb91409756631e1d23fe5a99aabe5b57a (patch)
tree9503fad14bc4faa7dc1d27758d195863ed670669
parenta8210efd341b3619ffeb57135a57c161b1d4f1cf (diff)
Remove unused utils
-rw-r--r--text_recognizer/networks/util.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/text_recognizer/networks/util.py b/text_recognizer/networks/util.py
deleted file mode 100644
index 6cf102f..0000000
--- a/text_recognizer/networks/util.py
+++ /dev/null
@@ -1,29 +0,0 @@
-"""Miscellaneous neural network utility functionality."""
-from functools import partial
-from importlib import import_module
-from typing import Any, Type
-
-from torch import nn
-
-
-def activation_function(activation: str) -> Type[nn.Module]:
- """Returns the callable activation function."""
- activation_fns = nn.ModuleDict(
- [
- ["elu", nn.ELU(inplace=True)],
- ["gelu", nn.GELU()],
- ["glu", nn.GLU()],
- ["leaky_relu", nn.LeakyReLU(negative_slope=1.0e-2, inplace=False)],
- ["none", nn.Identity()],
- ["relu", nn.ReLU(inplace=True)],
- ["selu", nn.SELU(inplace=True)],
- ["mish", nn.Mish(inplace=True)],
- ]
- )
- return activation_fns[activation.lower()]
-
-
-def load_partial_fn(fn: str, **kwargs: Any) -> partial:
- """Loads partial function/class."""
- module = import_module(".".join(fn.split(".")[:-1]))
- return partial(getattr(module, fn.split(".")[-1]), **kwargs)