@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)
approx.sample_node(theta,size=1).eval()
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.
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.