Is it possible to have both the inputs in logp as random variables?

I have a model formulation where I want to use logp(rv1, rv2), where rv1 and rv2 are two different random variables, currently, I can only use it as logp(rv, value).

I think you can. Have you tried?

If you see any problems you can use a dummy value variable and then replace by the RV, but I am not sure that’s ever needed.

from pytensor.graph.replace import graph_replace
import pymc as pm

x = pm.Normal.dist()
y = pm.Normal.dist()

x_value = x.clone()  # dummy variable for logp
x_logp = pm.logp(x, x_value)

x_logp = graph_replace(x_logp, replace={x_value: y})
1 Like