File size: 395 Bytes
8d7ec14 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
"""
Script provides functional interface for Mish activation function.
"""
# import pytorch
import torch
import torch.nn.functional as F
@torch.jit.script
def mish(input):
"""
Applies the mish function element-wise:
mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + exp(x)))
See additional documentation for mish class.
"""
return input * torch.tanh(F.softplus(input)) |