Assume, we have a function
$$ \mathcal{E}(\phi)=\mathbb{E}_{z \sim \text { Bernoulli}(\sigma(\phi))}[f(z)] $$
Here $z$ is a variable, and follow the Bernoulli distribution with parameters $\sigma(\phi)$, and $\sigma()$ is the sigmoid function. $\mathbb{E}$ is the Expectation, $f$ is a general function. How to compute the gradient
$$ \nabla_{\phi} \mathcal{E}(\phi) $$
Thanks,