Importance Sampling: prune_subsample_sites


Hi everybody,

I’m reading Pyro source code. In enum.get_importance_trace(), we have:

guide_trace = prune_subsample_sites(guide_trace)
model_trace = prune_subsample_sites(model_trace)

Why do we need to remove sites that were subsampled in iarange context from the importance trace of model and guide?

Thank you in advance!


Hi all,

So I will answer to myself. It turns out that pyro.iarange() create a site so obviously we need to remove them from the final trace.