`sample_node` no longer working?

@ferrine Were there any updates to sample_node functionality? I remember the code below worked just fine a few months ago and I recently updated to master and I can no longer produce a working example of that kind.

data = np.random.randint(3,size=(2,2)).astype(np.float32)

with pm.Model() as model:
    theta = pm.Gamma('g',1,1,shape=(2,2))
    data = pm.Poisson('data',theta,observed=data)

    inference = pm.ADVI()
    approx = inference.fit(n=2)

EDIT: logs for completeness.

Could you please try again from master? The VI module was just updated today.

I’m getting the same error after updating to master (I think I initially updated to the master after the new PR merged).

EDIT: I don’t know if that’s connected to the recent PR but I’m also getting much higher CPU usage now (all cores active in contrast to just one before the PR). This is when training on a GPU.

I just checked it with v3.1, it works just fine.

That’s weird. I am on master and it works just fine. @ferrine?

I think this is GPU and test_value related. Did you try to set theano.config.compute_test_value = 'off' there?

Thanks for reporting this. Please provide me with your theano flags so I can reproduce the issue

I’m using the following flags:


As an update in API. You can pass size=None to get single sample using approx. That is equivalent to apply_replacements I decided there is no reason to have 2 methods for the same task

@pwl This worked for me on latest master. However I have no GPU with me at the moment. You can try to set compute_test_value='ignore' as a workaround. Test values are annoying sometimes any I do not use them under the hood of VI.

So that worked on a CPU for me too, it only fails on a GPU.