Skip to content

Commit e032c25

Browse files
getting Q as RV
1 parent bc3f1c3 commit e032c25

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pymc_extras/inference/INLA/inla.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ def fit_INLA(
4949
"""
5050
model = pm.modelcontext(model)
5151

52-
# TODO is there a better way to check if it's a RV?
53-
# print(vars(Q.owner))
54-
# if isinstance(Q, TensorVariable) and "module" in vars(Q.owner):
55-
Q = model.rvs_to_values[Q] if isinstance(Q, TensorVariable) else Q
52+
# Get the TensorVariable if Q is provided as an RV
53+
if Q in model.rvs_to_values.keys():
54+
Q = model.rvs_to_values[Q]
5655

5756
# Marginalize out the latent field
5857
marginalize_kwargs = {

0 commit comments

Comments
 (0)