def f2(): f1() # for i in autoname(name="loop")(range(3)): <- this works too for i in autoname(range(3), name="loop"): f1() sample("x", dist.Bernoulli(0.5)) return sample(dist.Normal(0.0, 1.0))
def model2(): return pyro.sample("y", dist.Normal(0.0, 1.0))
def f2(): f1() for i in range(3): f1() sample("x", dist.Bernoulli(0.5)) return sample(dist.Normal(0.0, 1.0))
def f3(): f1() f1() f1() f2() return sample(dist.Normal(0, 1))
def f2(): sample("x", dist.Bernoulli(0.5)) sample("x", dist.Bernoulli(0.5)) sample("x", dist.Bernoulli(0.5)) return sample(dist.Normal(0.0, 1.0))
def f1(): sample(dist.Normal(0, 1)) sample(dist.Normal(0, 1)) return sample(dist.Bernoulli(0.5))