Structs§
- Gelu
Backward - Backward of the tanh-GELU approximation. Let inner = x + ax³, s = sigmoid(2cinner), t = tanh(cinner) = 2s-1 d/dx = 0.5(1 + t) + x * 0.5 * sech²(cinner) * c(1+3a*x²)
- Gelu
Forward - Forward: y = x / (1 + exp(-2 * c * (x + a*x³))) where c = sqrt(2/pi), a = 0.044715 — the tanh GELU approximation.
- Gelu
Forward Dispatch - Forward: y = x / (1 + exp(-2 * c * (x + a*x³))) where c = sqrt(2/pi), a = 0.044715 — the tanh GELU approximation.
- GeluOp
- Mish
Backward - Backward: dx = dy * (tanh(sp) + x * (1 - tanh²(sp)) * sigmoid(x)) where sp = softplus(x). Recomputes all intermediates from x.
- Mish
Forward - Forward: y = x * tanh(softplus(x)) = x * tanh(log(1 + exp(x)))
- Mish
Forward Dispatch - Forward: y = x * tanh(softplus(x)) = x * tanh(log(1 + exp(x)))
- MishOp
Functions§
- gelu_
backward - Backward of the tanh-GELU approximation. Let inner = x + ax³, s = sigmoid(2cinner), t = tanh(cinner) = 2s-1 d/dx = 0.5(1 + t) + x * 0.5 * sech²(cinner) * c(1+3a*x²)
- gelu_
forward - Forward: y = x / (1 + exp(-2 * c * (x + a*x³))) where c = sqrt(2/pi), a = 0.044715 — the tanh GELU approximation.
- mish_
backward - Backward: dx = dy * (tanh(sp) + x * (1 - tanh²(sp)) * sigmoid(x)) where sp = softplus(x). Recomputes all intermediates from x.
- mish_
forward - Forward: y = x * tanh(softplus(x)) = x * tanh(log(1 + exp(x)))