Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fritzo
Copy link
Member

@fritzo fritzo commented Nov 24, 2022

Addresses this forum post

This uses color gradients. It doesn't look perfect, but it's a good first pass. For example:

def model(x, y=None):
    with pyro.plate("N", 2):
        z = pyro.sample("z", dist.Normal(0, 1))
        y = pyro.sample("y", dist.Normal(0, 1), obs=y)
        pyro.sample("x", dist.Normal(y + z, 1), obs=x)

pyro.render_model(
    model,
    model_kwargs=[
        {"x": torch.zeros(2)},
        {"x": torch.zeros(2), "y": torch.zeros(2)},
    ]
)

image

Tested

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@fritzo fritzo requested a review from fehiepsi November 24, 2022 15:49
@fehiepsi
Copy link
Member

This looks pretty cool!! I'll take a pass soon

for thing in things:
for key, value in thing.items():
if key not in result:
result[key] = _deep_merge([t[key] for t in things])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is a little bit complicated to follow so it would be nice to add a test for _deep_merge.

Copy link
Member

@fehiepsi fehiepsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Fritz!

@fehiepsi fehiepsi merged commit 6d61ea9 into dev Dec 2, 2022
@fritzo fritzo deleted the render-semisupervised branch January 5, 2023 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants