Given the functional form of the EBM \(p(\mathbf {z}|\mathcal {C})\) , our next step is to approximate it with an efficient sampling network. To achieve this,
we train a distribution \(p_{\mathbf {\theta }}(\mathbf {z})\)  that minimizes the KL divergence \(\mathbb {D}_{\mathsf {KL}}(p_{\mathbf {\theta }}(\mathbf {z})\Vert p(\mathbf {z}|\mathcal {C}))\) .
Estimating \(\mathbb {D}_{\mathsf {KL}}(p_{\mathbf {\theta }}(\mathbf {z})\Vert p(\mathbf {z}|\mathcal {C}))\)  requires easily sampling \(\mathbf {z}\sim p_{\mathbf {\theta }}\)  and tractably computing \(p_{\mathbf {\theta }}(\mathbf {z})\) .
Inspired by [1]}, we model \(p_{\mathbf {\theta }}\)  with an INN \(f_{\mathbf {\theta }}\)  that defines a bijection \(\mathbf {z}= f_{\mathbf {\theta }}(\mathbf {\epsilon })\) , which has two merits besides the invertibility: (1) one can easily sample \(\mathbf {z}\)  by sampling \(\mathbf {\epsilon }\sim \mathcal {N}(\mathbf {0}, \mathbf {I})\)  and mapping it to \(\mathbf {z}= f_{\mathbf {\theta }}(\mathbf {\epsilon })\) , and (2) \(p_{\mathbf {\theta }}(\mathbf {z})\)  has a closed-form solution:
\(\log p_{\mathbf {\theta }}(\mathbf {z}) = \log \mathcal {N}(\mathbf {\epsilon }|\mathbf {0}, \mathbf {I}) - \log |\det (\frac{\partial f_{\mathbf {\theta }}}{\partial \mathbf {\epsilon }})|, \quad \mathbf {z}= f_{\mathbf {\theta }}(\mathbf {\epsilon }).\) 
