I want to use SVI to inference for a multivariate sequence with shape [365,5]. The code can be simplified as:

sigma=pyro.sample(dist.uniform(0,1).expand([5]).to_event(1))

#X[365,5],Y[365,5]

for i in pyro.plate(“data”,X):

…obs=pyro.sample(‘obs_{}’.format(i),dist.Normal(loc=X[:,i],scale=sigma[i]),obs=Y[:,i])

X and Y have a one-year length with 5 features. I gave a different sigma of Normal distribution for each feature. But this setting can not run. I appreciate any help. The error is :

ValueError: at site “obs_0”, invalid log_prob shape

Expected [], actual [365]

Try one of the following fixes:

- enclose the batched tensor in a with plate(…): context
- .to_event(…) the distribution being sampled
- .permute() data dimensions