From 84f51ab1b133bb4e08e5e0ebbd3cbddfc0568b92 Mon Sep 17 00:00:00 2001 From: Daniel Povey Date: Fri, 2 Dec 2022 20:28:17 +0800 Subject: [PATCH] Bug fix in scripting mode --- egs/librispeech/ASR/pruned_transducer_stateless7/scaling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/egs/librispeech/ASR/pruned_transducer_stateless7/scaling.py b/egs/librispeech/ASR/pruned_transducer_stateless7/scaling.py index 52eef52da..687fd6def 100644 --- a/egs/librispeech/ASR/pruned_transducer_stateless7/scaling.py +++ b/egs/librispeech/ASR/pruned_transducer_stateless7/scaling.py @@ -1272,8 +1272,8 @@ class Swoosh(torch.nn.Module): """Return tan-swish activation function which is tanh(x) sigmoid(x-1)n """ if torch.jit.is_scripting(): - one = torch.tensor(1.0, dtype=x.dtype, device=x.device) - return torch.logaddexp(one, x - 1.125) - 0.08 * x - 0.3 + zero = torch.tensor(0.0, dtype=x.dtype, device=x.device) + return torch.logaddexp(zero, x - 1.125) - 0.08 * x - 0.3 return SwooshFunction.apply(x)