Evaluating log posterior (or log prior/log likelihood) of model at arbitrary inputs

According to the PyMC3 docs the log posterior can be evaluated at specific points using the following:

with pm.Model() as model:
    z = pm.Normal('z', mu=0., sigma=5.)          
    x = pm.Normal('x', mu=z, sigma=1., observed=5.)          
model.logp({'z': 2.5}) 

(A related question regarding evaluating the log posterior in PyMC3 can be found here).

When I try this in pymc v4 I get the type error:
TypeError: unhashable type: 'dict'
Is there any way of doing this? I have checked the pymc v4 documentation for this versatility but without any examples I find it hard to understand/implement.

If it is possible, a simple working example would be greatly appreciated.

Many thanks,

In v4 you should do model.compile_logp()({"z": 2.5})

1 Like