Evaluating integrals in the paper Auto-Encoding Variational Bayes

It's actually not terribly difficult, the key observation is that the integral actually splits into a bunch of single variable integrals,

\begin{align} \int q_\phi({\bf z})\|{\bf z}\|_2^2d{\bf z}&=\int q_\phi({\bf z})(z_1^2+\ldots+z_n^2)d{\bf z}\notag\\ &=\int q_\phi({\bf z})z_1^2d{\bf z} + \ldots + \int q_\phi({\bf z})z_n^2d{\bf z}\notag\\ &=\int q_\phi(z_1)z_1^2dz_1 + \ldots + \int q_\phi(z_n)z_n^2dz_n\notag. \end{align}

Now since $q_\phi(z_i) = N(\mu, \sigma^2)$, the above expression can be rewritten in expected value form as,

$$\sum_{i=1}^n\text{E}Z_i^2,$$

and using the identity that $\text{Var}X = \text{E}X^2 - (\text{E}X)^2$, we obtain,

$$\sum_{i=1}^n\text{E}Z_i^2=\sum_{i=1}^n(\text{E}Z_i)^2 + \text{Var}Z_i=\sum_{i=1}^n\mu_i^2 + \sigma_i^2.$$