mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-11 06:55:27 +00:00
Bug fix in scripting mode
This commit is contained in:
parent
9a2a58e20d
commit
84f51ab1b1
@ -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)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user