Mindspore's fast gelu implementation.
(x)
| 5 | from ..quantization import QuantizedLinear |
| 6 | |
| 7 | def fast_gelu(x): |
| 8 | """Mindspore's fast gelu implementation.""" |
| 9 | if hasattr(torch._C, 'quick_gelu'): |
| 10 | return torch._C.quick_gelu(x) |
| 11 | return x / (1 + torch.exp(-1.702 * torch.abs(x))) * torch.exp(0.851 * (x - torch.abs(x))) |
| 12 | |
| 13 | |
| 14 | class MLP(torch.nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected