---
# System prepended metadata

title: Math with layer_norm applied on `h`

---

$$
\begin{align}
ln(\mathbf{s}) &= \frac{\mathbf{s} - \mu}{\mathbf{\sigma}}\\
\frac{\partial \; ln(\mathbf{s})}{\partial \; \mathbf{s}} &= \frac{1}{\sigma} \; 
\end{align}
$$

considering $\mu$ and $\sigma$ to be constant values

$$
\begin{align}
F(\mathbf{s}) &\approx F(\mathbf{s_0}) + \frac{\partial \; F(\mathbf{s_0})}{\partial \; \mathbf{s_0}}(\mathbf{s} - \mathbf{s_0}) \\
&= F(\mathbf{s_0}) + \frac{\partial \; F(\mathbf{s_0})}{\partial \; ln(\mathbf{s_0})} \times \frac{\partial \; ln(\mathbf{s_0})}{\partial \; \mathbf{s_0}}(\mathbf{s} - \mathbf{s_0})\\
&= F(\mathbf{s_0}) + J \times \frac{\mathbf{s} - \mathbf{s_0}}{\sigma_{\mathbf{s_0}}}
\end{align}
$$

with $\frac{\partial \; F(\mathbf{s_0})}{\partial \; ln(\mathbf{s_0})} = J$

$$
\begin{align}
F(\mathbf{s}) &\approx \frac{J}{\sigma_{\mathbf{s_0}}} \times \mathbf{s} + b\\
\text{where}\; b &= F(\mathbf{s_0}) - \frac{J}{\sigma_{\mathbf{s_0}}} \times \mathbf{s_0}
\end{align}
$$
