I’m trying to create a multinomial change point model but am running into problems due to my inexperience with Theano. My attempt looks like this:

```
import pymc3 as pm
import theano.tensor as tt
from theano.compile.ops import as_op
import numpy as np
import scipy.stats as stats
X = []
X.extend(stats.multinomial.rvs(n=10, p=[0.1,0.2,0.3,0.4,0.0], size=100))
X.extend(stats.multinomial.rvs(n=10, p=[0.1,0.2,0.2,0.3,0.2], size=25))
X = np.array(X)
@as_op(itypes=[tt.lscalar, tt.dvector, tt.dvector], otypes=[tt.dvector])
def mswitch(tau, p1, p2):
out = np.empty((len(X),5))
out[:tau] = p1.reshape(1,-1)
out[tau:] = p2.reshape(1,-1)
return out
with pm.Model() as model:
p1 = pm.Dirichlet('p1', np.ones(5))
p2 = pm.Dirichlet('p2', np.ones(5))
tau = pm.DiscreteUniform('tau', 0, len(X))
p = mswitch(tau, p1, p2)
X_ = pm.Multinomial('X_',10, p, observed=X)
start = pm.find_MAP()
trace = pm.sample(50, start=start)
```

This gives me an error on defining X_:

```
TypeError: For compute_test_value, one input test value does not have the requested type.
The error when converting the test value to that variable type:
Wrong number of dimensions: expected 1, got 2 with shape (125, 5).
```

Do I need to set the shape when defining p1/p2/X_ somehow?