AR model "too many indices for array"

I am looking into some time series models in pymc3, and am running into a lot of difficulties right out the gate with the AR class. Consider first the trivial example:

with pm.Model as model():
    pm.Normal("x", mu=0.0, sd=1.0)
pm.sample_prior_predictive(samples=100, model=model)

This works exactly as expected. I would like to do something similar with an AR model, however

with pm.Model() as model:
    pm.AR("ar", rho=[0.9], sd=5.0, constant=False,
          init=pm.Normal("x0", mu=0.0, sd=1.0))

fails immediately with IndexError: too many indices for array. I have not been able to instantiate an AR model at all unless I use observed=data, which is not what I want. Should my model be valid? Or do I have some problem?

Edit: This is on pymc3 3.6, Theano 1.0.3. with a more detailed trace:

.../theano/tensor/var.py in __getitem__(self, args)
    508         # Check if the number of dimensions isn't too large.
    509         if self.ndim < index_dim_count:
--> 510             raise IndexError('too many indices for array')
    511 
    512         # Convert an Ellipsis if provided into an appropriate number of

You need to provide shape (AR could not figure this out dynamically) and pass a distribution (instead of a RandomVariable) to init:

with pm.Model() as model:
    pm.AR("ar", rho=[0.9], sd=5.0, constant=False,
          init=pm.Normal.dist(mu=0.0, sd=1.0), shape=100)

4 Likes