MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / fast_gelu

Function fast_gelu

codegeex/oneflow/codegeex_model.py:7–11  ·  view source on GitHub ↗

Mindspore's fast gelu implementation.

(x)

Source from the content-addressed store, hash-verified

5from ..quantization import QuantizedLinear
6
7def 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
14class MLP(torch.nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected