Merge pull request #1753 from digantamisra98/patch-1

Added Mish Activation Function
This commit is contained in:
Thomas Wolf 2019-11-28 15:24:08 +01:00 committed by GitHub
commit 49a69d5b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,7 +138,11 @@ def swish(x):
return x * torch.sigmoid(x) return x * torch.sigmoid(x)
ACT2FN = {"gelu": gelu, "relu": torch.nn.functional.relu, "swish": swish, "gelu_new": gelu_new} def mish(x):
return x * torch.tanh(nn.functional.softplus(x))
ACT2FN = {"gelu": gelu, "relu": torch.nn.functional.relu, "swish": swish, "gelu_new": gelu_new, "mish": mish}
BertLayerNorm = torch.nn.LayerNorm BertLayerNorm = torch.nn.LayerNorm