It sounds like you are trying to run a model in data-generating mode (i.e. outside of inference), but that model has a pyro.sample(..., obs=...) statement somewhere. This mode of operation doesn’t quite make sense, because by the time you’ve drawn earlier latent variables from the prior, they no longer correspond to the conditional obs=...) in your model. That is, you’ll need an inference algorithm to handle the observe statement.
If you simply want to generate data then you can remove the obs= part. I often write models with optional data as in
def model(data=None):
x = pyro.sample("x", ...)
y = pyro.sample("y", ..., obs=data)
return y
that way when I want to generate fake data I can call data = model(), and when I want to run inference I can pass that data to SVI as in svi.step(data).
Let me know if I’ve misunderstood; I can only guess at your use case.
@fritzo but what if, even outside of inference, you want to overwrite/replace some sample statement? e.g. you want to sample locations to render some objects, but you need to constrain these choices so that objects don’t overlap and/or get only partially observed due to canvas overflow…