From 90f7e3882610945077949b96a011c92a8e7c8106 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 1 Jun 2022 23:15:54 +0200 Subject: Format --- text_recognizer/networks/conformer/depth_wise_conv.py | 9 +++++++-- text_recognizer/networks/conformer/glu.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'text_recognizer') diff --git a/text_recognizer/networks/conformer/depth_wise_conv.py b/text_recognizer/networks/conformer/depth_wise_conv.py index 9465b7c..1dbd0b8 100644 --- a/text_recognizer/networks/conformer/depth_wise_conv.py +++ b/text_recognizer/networks/conformer/depth_wise_conv.py @@ -5,8 +5,13 @@ 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") + 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) diff --git a/text_recognizer/networks/conformer/glu.py b/text_recognizer/networks/conformer/glu.py index 016b684..1a7c201 100644 --- a/text_recognizer/networks/conformer/glu.py +++ b/text_recognizer/networks/conformer/glu.py @@ -6,7 +6,7 @@ class GLU(nn.Module): def __init__(self, dim: int) -> None: super().__init__() self.dim = dim - + def forward(self, x: Tensor) -> Tensor: out, gate = x.chunk(2, dim=self.dim) return out * gate.sigmoid() -- cgit v1.2.3-70-g09d2