Skip to content

Commit 33c5766

Browse files
committed
moved gaussian process checking from clone_model to lower level fgraph_from_model
1 parent bcb4309 commit 33c5766

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pymc/model/fgraph.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ def fgraph_from_model(
160160
"Nested sub-models cannot be converted to fgraph. Convert the parent model instead"
161161
)
162162

163+
check_for_gp_vars = [
164+
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k
165+
]
166+
if len(check_for_gp_vars) > 0:
167+
warnings.warn("Unable to clone Gaussian Process Variables", UserWarning)
168+
163169
# Collect PyTensor variables
164170
rvs_to_values = model.rvs_to_values
165171
rvs = list(rvs_to_values.keys())
@@ -393,11 +399,6 @@ def clone_model(model: Model) -> Model:
393399
z = pm.Deterministic("z", clone_x + 1)
394400
395401
"""
396-
check_for_gp_vars = [
397-
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k
398-
]
399-
if len(check_for_gp_vars) > 0:
400-
warnings.warn("Unable to clone Gaussian Process Variables", UserWarning)
401402
return model_from_fgraph(fgraph_from_model(model)[0], mutate_fgraph=True)
402403

403404

0 commit comments

Comments
 (0)