Is there a way to store variables computed during each pyro MCMC sample?

In particular, I compute 2 log likelihoods (both scalars) in my MCMC model and then return their sum. I’d like to store the value of these likelihoods for each sample and be able to access them after the run. So if there are 1000 samples, each output likelihood would be a vector of length 1000. One of these likelihoods is computed as a numpy value from a non-pyro function.

Thank you!

I use numpyro, but if I’m understanding your issue correctly, deterministic should do what you want.

Thank you! I was able to use deterministic variables in combination with the function Predictive.