# Notation: What does the tilde below of the expectation mean? [duplicate]

I am reading about variational auto encoders, and there is the below loss function:

$$l_i(\Theta,\phi) = – {\mathbb{E}}_{z\sim q} \left[\log p_\phi(x_i|z)\right] + KL(q_{\phi}(z_i|x)||p(z))$$

What does the notation $$z\sim q$$ under $$\mathbb{E}$$ mean? I just have
seen notations like $$E(X)$$ or $$\langle X\rangle$$ for expected value, $$\mathbb{E}$$.

What does this notation generally mean when using $$\mathbb{E}_{x\sim y}$$ for some $$x$$ and some $$y$$?

$$z\sim q$$ means that RV $$Z$$ is distributed with respect to $$q$$ function, i.e. $$q(z)$$, where $$q(z)$$ is a valid PDF/PMF. So, the expectation can be unfold as (assuming $$z$$ being continuous)
$$\mathbb{E}_{z\sim q}[\log_{\phi}(x_i|z)]=\int_{-\infty}^\infty \log_\phi (x_i|z) q(z) dz$$