merged sample_latent_vars with update_pi