From 00be56c7a0ef956a7790598e73cf19e9ce6086cf Mon Sep 17 00:00:00 2001 From: Daniel Povey Date: Wed, 16 Mar 2022 12:49:00 +0800 Subject: [PATCH] Remove dead code --- .../ASR/transducer_stateless/conformer.py | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/egs/librispeech/ASR/transducer_stateless/conformer.py b/egs/librispeech/ASR/transducer_stateless/conformer.py index 0b89fdcd2..cafc04ed1 100644 --- a/egs/librispeech/ASR/transducer_stateless/conformer.py +++ b/egs/librispeech/ASR/transducer_stateless/conformer.py @@ -876,8 +876,7 @@ class ConvolutionModule(nn.Module): self.deriv_balancer2 = DerivBalancer(channel_dim=1, min_positive=0.05, max_positive=1.0) - # Shape: (channels, 1), broadcasts with (batch, channel, time). - self.activation = SwishOffset() + self.activation = DoubleSwish() self.pointwise_conv2 = ScaledConv1d( channels, @@ -918,24 +917,6 @@ class ConvolutionModule(nn.Module): return x.permute(2, 0, 1) -class Swish(torch.nn.Module): - """Construct an Swish object.""" - - def forward(self, x: Tensor) -> Tensor: - """Return Swich activation function.""" - return x * torch.sigmoid(x) - -class SwishOffset(torch.nn.Module): - """Construct an SwishOffset object.""" - def __init__(self, offset: float = -1.0) -> None: - super(SwishOffset, self).__init__() - self.offset = offset - - def forward(self, x: Tensor) -> Tensor: - """Return Swich activation function.""" - return x * torch.sigmoid(x + self.offset) - - class Identity(torch.nn.Module): def forward(self, x: Tensor) -> Tensor: return x