Skip to content

Commit

Permalink
moved gaussian process checking from clone_model to lower level fgrap…
Browse files Browse the repository at this point in the history
…h_from_model
  • Loading branch information
Dekermanjian committed Sep 9, 2024
1 parent bcb4309 commit 33c5766
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pymc/model/fgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def fgraph_from_model(
"Nested sub-models cannot be converted to fgraph. Convert the parent model instead"
)

check_for_gp_vars = [
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k
]
if len(check_for_gp_vars) > 0:
warnings.warn("Unable to clone Gaussian Process Variables", UserWarning)

# Collect PyTensor variables
rvs_to_values = model.rvs_to_values
rvs = list(rvs_to_values.keys())
Expand Down Expand Up @@ -393,11 +399,6 @@ def clone_model(model: Model) -> Model:
z = pm.Deterministic("z", clone_x + 1)
"""
check_for_gp_vars = [
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k
]
if len(check_for_gp_vars) > 0:
warnings.warn("Unable to clone Gaussian Process Variables", UserWarning)
return model_from_fgraph(fgraph_from_model(model)[0], mutate_fgraph=True)


Expand Down

0 comments on commit 33c5766

Please sign in to comment.