fix(infer): render_model draws edges through deterministic sites#3456
Open
nileshpatil6 wants to merge 1 commit into
Open
fix(infer): render_model draws edges through deterministic sites#3456nileshpatil6 wants to merge 1 commit into
nileshpatil6 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3441
pyro.render_modelsilently omitted edges when a sample site received values from apyro.deterministicsite or a Delta-transformed sample. Only regular sample sites were wrapped as provenance anchors inTrackProvenance, so downstream sites resolved their dependencies transitively, skipping the intermediate nodes.Root cause:
get_model_relationspassedinclude_deterministictoTrackProvenance, so wheninclude_deterministic=False(the default), deterministic and Delta sites were not wrapped with their own provenance anchor. A site likey = Normal(y_mean, 1)would showxas its parent instead ofy_mean, andy_mean -> yedge was never built.Fix: Always use
TrackProvenance(include_deterministic=True)insideget_model_relationsso every site acts as a provenance anchor for the dependency graph. Theinclude_deterministicparameter still controls which nodes appear in the rendered output. Updatedtest_get_model_relationsto reflect the now-correct direct-parent edges.