MCPcopy Create free account
hub / github.com/geekcomputers/Python / GELU

Class GELU

ML/src/python/neuralforge/nn/activations.py:5–10  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import torch.nn.functional as F
4
5class GELU(nn.Module):
6 def __init__(self):
7 super().__init__()
8
9 def forward(self, x):
10 return 0.5 * x * (1.0 + torch.tanh(0.7978845608 * (x + 0.044715 * torch.pow(x, 3))))
11
12class Swish(nn.Module):
13 def __init__(self):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected