This commit is contained in:
@@ -26,7 +26,7 @@ def gelu_new(x):
|
|||||||
""" Implementation of the gelu activation function currently in Google Bert repo (identical to OpenAI GPT).
|
""" Implementation of the gelu activation function currently in Google Bert repo (identical to OpenAI GPT).
|
||||||
Also see https://arxiv.org/abs/1606.08415
|
Also see https://arxiv.org/abs/1606.08415
|
||||||
"""
|
"""
|
||||||
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))))
|
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3.0))))
|
||||||
|
|
||||||
|
|
||||||
if torch.__version__ < "1.4.0":
|
if torch.__version__ < "1.4.0":
|
||||||
|
|||||||
Reference in New Issue
Block a user