xnn.common.models.ops.SiLU#
- class xnn.common.models.ops.SiLU(inplace=False)[source]#
Bases:
SiLUtorch.nn.SiLUwhose derivative stays the fused kernel under autograd.Differentiated with a graph (the forces of a force loss), torch writes the derivative of
siluas six recorded operations, each differentiated again for the parameter gradients. Here the derivative is the onesilu_backwardkernel torch uses without a graph, and its own derivative the closed formsilu''(x) = s (1 - s) (2 + x (1 - 2 s))withs = sigmoid(x). In training on inputs of at leastFUSED_SLOPE_MIN_ELEMENTS(a force loss differentiates the derivative); otherwise, and under TorchScript, the values and derivatives are those oftorch.nn.functional.silu(), the same numbers.- Parameters:
inplace (bool)