After upgrading to pystan 3, I noticed that I am no longer able to run a number of older models containing vectors in the data block that may be length 0. For instance, in older versions of pystan (2.19.0.0), I might declare a model with a data block containing the following variables:
data {
int<lower=0, upper=1> nb;
int<lower=1> alpha[nb];
...
}
...
And then pass the following entries in a data dict in order to fit the model:
import numpy as np
data_dict = {
'nb': 0,
'alpha': np.array([], dtype=int),
...
}
As of upgrading to Pystan 3.1.1, attempting to do so yields the following error:
RuntimeError: Error calling get_param_names: `Exception: int variable contained non-int values; processing stage=data initialization; variable name=alpha; base type=int (in '/var/folders/cz/tz9nr4710px51vhl4kq588jr0001bz/T/httpstan_g7gn5td2/model_4zofs5uu.stan', line 8, column 4 to column 27)`
Perhaps this is still possible through some other means, but I cannot find anything in the pystan 3 documentation about how to provide zero-length vectors as inputs.
I am working on Mac OS Catalina (10.15.7) with Python 3.7.9 and pystan 3.1.1.