I would like to code up a GPLVM with Poisson emissions and perform MCMC inference (VI is also fine, if that is easier). The model is

```
x_n ~ N(0, I)
f_j ~ GP(0, K)
Y_{nj} ~ Poisson(exp(f_j(x_n)))
```

In other words, `Y`

is an `N x J`

count matrix, and its `J`

columns are Gaussian process-distributed maps from a latent variable `X`

, an `N x D`

matrix.

Following the docstring example here, I have tried to code this up:

```
import pyro
import pyro.contrib.gp as gp
from pyro.distributions import Normal, Poisson
from pyro.infer.mcmc import MCMC, NUTS
import torch
N = 500 # Samples.
J = 50 # Features.
D = 2 # Latent dimension.
Y = torch.distributions.Poisson(100).sample((N, J))
kernel = gp.kernels.RBF(input_dim=D)
mu_x = torch.zeros(D)
cov_x = torch.eye(D)
mu_f = torch.zeros(N)
def model(data):
X = pyro.sample('X', Normal(mu_x, cov_x))
K_x = kernel(X)
F = pyro.sample('F', Normal(mu_f, K_x))
theta = torch.exp(F)
return pyro.sample('Y', Poisson(theta), obs=data)
nuts_kernel = NUTS(model)
mcmc = MCMC(nuts_kernel, num_samples=500, warmup_steps=100)
mcmc.run(data=Y)
mcmc.get_samples()['X'].mean(0)
```

However, I get the error:

```
RuntimeError: The size of tensor a (500) must match the size of tensor b (2) at non-singleton dimension 1
Trace Shapes:
Param Sites:
lengthscale
variance
Sample Sites:
X dist 2 2 |
value 2 2 |
```

It seems clear that `Y`

and `X`

do not have the same first dimension, but I donâ€™t know how to sample `N`

random variables `x_n`

using Pyro.

Thanks for any help.