summaryrefslogtreecommitdiff
path: root/text_recognizer/networks/transformer/residual.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-05-09 00:36:55 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-05-09 00:36:55 +0200
commit548f52b35062e258622ea638ed1b132d6759a07a (patch)
treee9262d0f934ac4f9392f20cb4fcf7be6033e3cb7 /text_recognizer/networks/transformer/residual.py
parent805d5726c17b83e00dcea0d2608dcd83a91f723d (diff)
Attention layer soon done
Diffstat (limited to 'text_recognizer/networks/transformer/residual.py')
-rw-r--r--text_recognizer/networks/transformer/residual.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/text_recognizer/networks/transformer/residual.py b/text_recognizer/networks/transformer/residual.py
new file mode 100644
index 0000000..1547df6
--- /dev/null
+++ b/text_recognizer/networks/transformer/residual.py
@@ -0,0 +1,8 @@
+"""Residual function."""
+from torch import nn, Tensor
+
+
+class Residual(nn.Module):
+ def forward(self, x: Tensor, residual: Tensor) -> Tensor:
+ """Applies the residual function."""
+ return x + residual