summaryrefslogtreecommitdiff
path: root/text_recognizer/networks/conformer/depth_wise_conv.py
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-06-01 23:11:05 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-06-01 23:11:05 +0200
commit729867b14754bffd98a3406b5d3a2eb9d09bc3bc (patch)
treed22fbe9a9aacd2b7e457f8af4b667c5c8d927d73 /text_recognizer/networks/conformer/depth_wise_conv.py
parentdb86cef2d308f58325278061c6aa177a535e7e03 (diff)
WIP conformer
Diffstat (limited to 'text_recognizer/networks/conformer/depth_wise_conv.py')
-rw-r--r--text_recognizer/networks/conformer/depth_wise_conv.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/text_recognizer/networks/conformer/depth_wise_conv.py b/text_recognizer/networks/conformer/depth_wise_conv.py
new file mode 100644
index 0000000..9465b7c
--- /dev/null
+++ b/text_recognizer/networks/conformer/depth_wise_conv.py
@@ -0,0 +1,12 @@
+"""Depthwise 1D convolution."""
+from torch import nn, Tensor
+
+
+class DepthwiseConv1D(nn.Module):
+ def __init__(self, in_channels: int, out_channels: int, kernel_size: int) -> None:
+ super().__init__()
+ self.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, groups=in_channels,
+ padding="same")
+
+ def forward(self, x: Tensor) -> Tensor:
+ return self.conv(x)