So I noticed something strange while trying to write my model (which isn’t correct as yet and I would really appreciate your inputs), I’ve posted my notebook in this gist.

What’s happening is when I run the line `with model: trace2 = pm.sample(50, njobs=4)`

I get a shape mismatch error

```
~/.local/lib/python3.5/site-packages/pymc3/sampling.py in init_nuts(init, chains, n_init, model, random_seed, progressbar, **kwargs)
1426 var = np.ones_like(mean)
1427 potential = quadpotential.QuadPotentialDiagAdapt(
-> 1428 model.ndim, mean, var, 10)
1429 elif init == 'advi+adapt_diag_grad':
1430 approx = pm.fit(
~/.local/lib/python3.5/site-packages/pymc3/step_methods/hmc/quadpotential.py in __init__(self, n, initial_mean, initial_diag, initial_weight, adaptation_window, dtype)
119 if initial_diag is not None and len(initial_diag) != n:
120 raise ValueError('Wrong shape for initial_diag: expected %s got %s'
--> 121 % (n, len(initial_diag)))
122 if len(initial_mean) != n:
123 raise ValueError('Wrong shape for initial_mean: expected %s got %s'
ValueError: Wrong shape for initial_diag: expected 77 got 76
```

(The one extra dimension corresponds to the conditional)

To check what was being passed to `model.dict_to_array(vals)`

, I printed `start.keys()`

before line 1425 in sampling.py

Oddly enough the error went away and I was able to run the inference without any trouble, as you will see in the notebook.

cc @junpenglao @lucianopaz (as you’re both devs)