From 2117f46361c2b2deb63194de43098e1a17714d61 Mon Sep 17 00:00:00 2001 From: Daniel Povey Date: Sat, 12 Mar 2022 19:02:14 +0800 Subject: [PATCH] DoubleSwish fix --- egs/librispeech/ASR/conformer_ctc/subsampling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/egs/librispeech/ASR/conformer_ctc/subsampling.py b/egs/librispeech/ASR/conformer_ctc/subsampling.py index 13259d166..6bf0aefe4 100644 --- a/egs/librispeech/ASR/conformer_ctc/subsampling.py +++ b/egs/librispeech/ASR/conformer_ctc/subsampling.py @@ -537,13 +537,13 @@ class DerivBalancer(torch.nn.Module): self.max_factor, self.min_abs) +class DoubleSwish(torch.nn.Module): + def forward(self, x: Tensor) -> Tensor: + """Return Swich activation function.""" + return x * torch.sigmoid(x - 1.0) def _test_exp_scale_swish(): - class DoubleSwish(torch.nn.Module): - def forward(self, x: Tensor) -> Tensor: - """Return Swich activation function.""" - return x * torch.sigmoid(x - 1.0) x1 = torch.randn(50, 60).detach() x2 = x1.detach()