MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / gelu

Function gelu

imperative/python/megengine/functional/nn.py:892–900  ·  view source on GitHub ↗

r"""Applies the element-wise function: .. math:: \text{gelu}(x) = x\Phi(x) where :math:`\Phi(x)` is the Cumulative Distribution Function for Gaussian Distribution.

(x)

Source from the content-addressed store, hash-verified

890
891
892def gelu(x):
893 r"""Applies the element-wise function:
894
895 .. math::
896 \text{gelu}(x) = x\Phi(x)
897
898 where :math:`\Phi(x)` is the Cumulative Distribution Function for Gaussian Distribution.
899 """
900 return _elwise(x, mode=Elemwise.Mode.GELU)
901
902
903def softplus(inp: Tensor) -> Tensor:

Callers 1

forwardMethod · 0.50

Calls 1

_elwiseFunction · 0.50

Tested by

no test coverage detected