Unknown NUTS failure with error but ADVI and Metropolis works

Hello everyone,

I’m having an issue with NUTS in that it produces the error

Traceback (most recent call last):
  File "/Users/dhooghe/anaconda3/lib/python3.6/site-packages/theano/compile/function_module.py", line 903, in __call__
    self.fn() if output_subset is None else\
NotImplementedError: c_sync: expected an aligned array, got non-aligned array of type 12 with 2 dimensions, with 3 last dims -1, 62, 14000 and 3 last strides -1 8, 496.

This issue only occurs when I use a lot of data points. If I downsize to 2000 it works. ADVI and metropolis work with the number of data points I want to use without downsizing. My model looks like:

def CreateModel(X, Y, NumberOfFeatures, NumberOfClasses):
    with pm.Model() as Model:

        Slope = pm.Normal("Slope", 0., 100., shape=(NumberOfFeatures, NumberOfClasses))
        Intercept = pm.Normal("Intercept", 0., 100., shape = NumberOfClasses, testval = np.ones(NumberOfClasses))
        LogOdds = pm.math.dot(X, Slope) + Intercept
        
        Output = pm.Multinomial("Bernoulli", p = logit(LogOdds), n = 1, observed = Y)
        
    return Model

with X and Y being theano shared variables. X has dimensions [14000, 62] with y having dimensions of [14000, 4]. I’m thinking this is a memory issue but I have 16 GB and the other samples work. Any thoughts? Thank you!

A quick update. When I sample with njobs = 1, NUTS works.

Are you on master? This might be recently fixed: https://github.com/pymc-devs/pymc3/pull/2872

Thank you so much again, junpenglao. Serves me right for using the version in conda!