Skip to content

fix(infer): render_model draws edges through deterministic sites#3456

Open
nileshpatil6 wants to merge 1 commit into
pyro-ppl:devfrom
nileshpatil6:fix/render-model-deterministic-edges
Open

fix(infer): render_model draws edges through deterministic sites#3456
nileshpatil6 wants to merge 1 commit into
pyro-ppl:devfrom
nileshpatil6:fix/render-model-deterministic-edges

Conversation

@nileshpatil6

Copy link
Copy Markdown

Fixes #3441

pyro.render_model silently omitted edges when a sample site received values from a pyro.deterministic site or a Delta-transformed sample. Only regular sample sites were wrapped as provenance anchors in TrackProvenance, so downstream sites resolved their dependencies transitively, skipping the intermediate nodes.

Root cause: get_model_relations passed include_deterministic to TrackProvenance, so when include_deterministic=False (the default), deterministic and Delta sites were not wrapped with their own provenance anchor. A site like y = Normal(y_mean, 1) would show x as its parent instead of y_mean, and y_mean -> y edge was never built.

Fix: Always use TrackProvenance(include_deterministic=True) inside get_model_relations so every site acts as a provenance anchor for the dependency graph. The include_deterministic parameter still controls which nodes appear in the rendered output. Updated test_get_model_relations to reflect the now-correct direct-parent edges.

pyro.render_model omitted edges when a sample site received a tensor
from a pyro.deterministic site or a pyro.sample wrapped in a Delta
transform. get_model_relations used TrackProvenance with
include_deterministic passed through, so deterministic and Delta sites
were not wrapped with their own provenance anchor. Downstream sites
then resolved their parents transitively, skipping the intermediate
deterministic/Delta nodes.

Fix by always using TrackProvenance(include_deterministic=True) inside
get_model_relations so every site acts as a provenance anchor. This
correctly builds direct-parent edges regardless of the
include_deterministic output filter.

Update test_get_model_relations to reflect correct edges (i now lists
f, g, h as direct parents instead of resolving them away to e).

Fixes pyro-ppl#3441

Signed-off-by: nileshpatil6 <technil6436@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] pyro.render_model omits edges

1 participant