What's the point of giving different names to observed data in Pyro.sample?

I’m reading the tutorials. I’m comfortable with everything so far, apart from understanding why do have to ‘take care to pass unique names to pyro.sample’

This was touched on in first tuorial, and in SVI tutorial Part I. In particular, here’s this snipprt:

def model(data):
    alpha0 = torch.tensor(10.0)
    beta0 = torch.tensor(10.0)
    f = pyro.sample("latent_fairness", dist.Beta(alpha0, beta0))
    # loop over the observed data
    for i in range(len(data)):
        pyro.sample("obs_{}".format(i), dist.Bernoulli(f), obs=data[i])

Why is it that I can’t pass the data in one go without for loop, and what’s the deal with different name for each sample?

Thanks.

Hi @Bayes, you can pass data without for loop. The requirement is to follow up with SVI tutorial part II. :wink: