xnn.common.models.ops.GELU#
- class xnn.common.models.ops.GELU(approximate='none')[source]#
Bases:
GELUtorch.nn.GELU(exact form) whose derivative stays the fused kernel under autograd.As
SiLU: the derivative is the onegelu_backwardkernel, its own derivative the closed formgelu''(x) = phi(x) (2 - x^2)with the standard normal densityphi, under the same conditions. The"tanh"approximation and TorchScript usetorch.nn.functional.gelu().- Parameters:
approximate (str)