Can I use infer_discrete() to get the posterior distribution of discrete latent variables?

Hi, guys, I’m a begginer of pyro. My question is:
infer_discrete() can get the map value of discrete latent sample site according to observation. So I guess there is a way to get the corresponding posterior distribution, where the map value comes from?

The only way I know to get the distribution is using sampling to approximate by running the api for multiple times with temperature as 1. But this method seems indirect and computation-consuming.
Is thers any misunderstanding of this api or anything I ignore?


1 Like