summaryrefslogtreecommitdiff
path: root/text_recognizer/networks/transformer/attention_layers.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-05-06 22:28:25 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-05-06 22:28:25 +0200
commit805d5726c17b83e00dcea0d2608dcd83a91f723d (patch)
tree850af62a8e2d558d82aa4dbf5b8611755d256b89 /text_recognizer/networks/transformer/attention_layers.py
parent4defc734b681071e19dd86404abd416d24330b9a (diff)
Working on attention layer configuration
Diffstat (limited to 'text_recognizer/networks/transformer/attention_layers.py')
-rw-r--r--text_recognizer/networks/transformer/attention_layers.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/text_recognizer/networks/transformer/attention_layers.py b/text_recognizer/networks/transformer/attention_layers.py
new file mode 100644
index 0000000..721fa27
--- /dev/null
+++ b/text_recognizer/networks/transformer/attention_layers.py
@@ -0,0 +1,19 @@
+"""Generates the attention layer architecture."""
+from typing import Type
+
+import torch
+from torch import nn, Tensor
+
+
+class AttentionLayers(nn.Module):
+ def __init__(
+ self,
+ dim: int,
+ depth: int,
+ num_heads: int,
+ norm_layer: Type[nn.Module],
+ causal: bool = False,
+ cross_attend: bool = False,
+ only_cross: bool = False,
+ ) -> None:
+ pass