File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,7 @@ def fgraph_from_model(
223
223
copy_inputs = True ,
224
224
)
225
225
# Copy model meta-info to fgraph
226
+ fgraph .check_bounds = model .check_bounds
226
227
fgraph ._coords = model ._coords .copy ()
227
228
fgraph ._dim_lengths = {k : memo .get (v , v ) for k , v in model ._dim_lengths .items ()}
228
229
@@ -318,6 +319,7 @@ def first_non_model_var(var):
318
319
# TODO: Consider representing/extracting them from the fgraph!
319
320
_dim_lengths = {k : memo .get (v , v ) for k , v in _dim_lengths .items ()}
320
321
322
+ model .check_bounds = getattr (fgraph , "check_bounds" , False )
321
323
model ._coords = _coords
322
324
model ._dim_lengths = _dim_lengths
323
325
Original file line number Diff line number Diff line change @@ -397,3 +397,13 @@ def test_multivariate_transform():
397
397
new_ip = new_m .initial_point ()
398
398
np .testing .assert_allclose (ip ["x_simplex__" ], new_ip ["x_simplex__" ])
399
399
np .testing .assert_allclose (ip ["y_cholesky-cov-packed__" ], new_ip ["y_cholesky-cov-packed__" ])
400
+
401
+
402
+ def test_check_bounds_preserved ():
403
+ with pm .Model (check_bounds = True ) as m :
404
+ x = pm .HalfNormal ("x" )
405
+
406
+ assert clone_model (m ).check_bounds
407
+
408
+ m .check_bounds = False
409
+ assert not clone_model (m ).check_bounds
You can’t perform that action at this time.
0 commit comments