code: def test_reparam_log_joint(model, kwargs):
      guide = AutoIAFNormal(model)
      guide(**kwargs)
      neutra = NeuTraReparam(guide)
      reparam_model = neutra.reparam(model)
      _, pe_fn, transforms, _ = initialize_model(
          model, model_kwargs=kwargs
      )
      init_params, pe_fn_neutra, _, _ = initialize_model(
          reparam_model, model_kwargs=kwargs
      )
      latent_x = list(init_params.values())[0]
      transformed_params = neutra.transform_sample(latent_x)
      pe_transformed = pe_fn_neutra(init_params)
      neutra_transform = ComposeTransform(
          guide.get_posterior(**kwargs).transforms
      )
      latent_y = neutra_transform(latent_x)
      log_det_jacobian = neutra_transform.log_abs_det_jacobian(
          latent_x, latent_y
      )
      pe = pe_fn(
          {k: transforms[k](v) for k, v in transformed_params.items()}
      )
      assert_close(pe_transformed, pe - log_det_jacobian)
  
file_path: pyro/tests/infer/reparam/test_neutra.py
imports: import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro import optim
  from pyro.distributions.transforms import ComposeTransform
  from pyro.infer import MCMC, NUTS, SVI, Trace_ELBO
  from pyro.infer.autoguide import AutoDiagonalNormal, AutoIAFNormal, AutoMultivariateNormal
  from pyro.infer.mcmc.util import initialize_model
  from pyro.infer.reparam import NeuTraReparam
  from tests.common import assert_close
  from .util import check_init_reparam
label_desc: Use image node_id 4 for calling a global function with example usage: test_reparam_log_joint(model, kwargs) without return types