We use variational inference to learn an approximate posterior over latent variables conditioned on the given data, which means we need to construct an approximating distribution \(q_{\phi }\)  parameterized by \(\phi \) . We train the generative model using Auto-Encoding Variable Bayes (AEVB) algorithm [1]}:
\(\max _{\theta _{},\phi }\mathbb {E}_{p(\mathbf {x}_{1:T})}\bigg [\mathbb {E}_{q_{\phi }}\bigg [\log \frac{p_{\theta _{}}(\mathbf {x}_{1:T},\mathbf {z}_{1:T})}{q_{\phi }(\mathbf {z}_{1:T}|\mathbf {x}_{1:T})}\bigg ]\bigg ]\) 
