Skip to content

[bug] Multinomial distribution raises RuntimeError within pyro.render_model #3436

Description

@markmcleod-mf

Issue Description

The multinomial distribution when passed a pyro.param as probabilities and sampled within a call of pyro.render_model raises a runtime error.

This does not occur without the render_model, or if not using a parameter, or with other distributions.

Environment

  • Ubuntu 24.04,
  • python 3.12
  • torch 2.7.0
  • pyro 1.9.1

Code Snippet

import pyro
import torch
import pyro.distributions as dist

def model():
    x = pyro.param("x",torch.tensor([0.1,0.2,0.7]))
    # Multinomial causes an error when within render_model
    y=pyro.sample("y", dist.Multinomial(total_count=10, probs=x))
    # Other distributions do not
    # y=pyro.sample("y", dist.Dirichlet(concentration=x))
    return y


print(model())  # tensor([1., 2., 7.]) or similar

viz = pyro.render_model(model)  # Error when using Multinomial distribution

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions