There is something that I am still not understanding with regard to shapes in Pyro. Specifically, I am always running into errors when using Predictive that I am not getting when I fit the model. For example, a model that contains:

```
mu = pyro.sample("mu", Normal(loc=dtensor(mean_priors), scale=dtensor(10.)).expand([P]).to_event(1))
```

creates a variable of length P with the mean values in `mean_priors`

. Further down in the model, this is used as an expected value

```
theta = mu[p_index]
```

which works just fine for the set of indices `p_index`

. However, when I run `Predictive`

after fitting:

```
ppc = pyro.infer.Predictive(
model,
guide=guide,
num_samples=100,
return_sites=["pred_values"]
)
ppc_samples = ppc(*data[:-1], None)
```

It fails due to indexing:

```
426
427 # Expected value
---> 428 theta = mu[p_index]
IndexError: index 2038 is out of bounds for dimension 0 with size 1
```

Its not clear to me what is causing this, given that the inputs are exactly the same.