As far as I understand, the pyro primitive sample(name, fn, *args, **kwargs) is supposed to randomly sample a data point from my distribution fn. However, this is not the case, as running the following code will always give the same results:
for _ in range(5):
x = pyro.sample("my_sample", pyro.distributions.Normal(1.,2.))
print(x)
This will always return
tensor(-1.7810)
tensor(-0.6305)
tensor(0.3591)
tensor(2.4755)
tensor(-2.5067)
It doesn’t make any sense to me… When sampling from a probability distribution I do not want to have sample no. i to always be the same value. Why is that in this case? Have I misunderstood the purpose of this primitive?