Skip to content

Commit

Permalink
Disable GC on logp_dlogp function
Browse files Browse the repository at this point in the history
Related to #7539
  • Loading branch information
ricardoV94 committed Nov 24, 2024
1 parent c1af5d8 commit cb8d51e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import pytensor.tensor as pt
import scipy.sparse as sps

from pytensor.compile import DeepCopyOp, Function, get_mode
from pytensor.compile import DeepCopyOp, Function, Mode, get_mode
from pytensor.compile.sharedvalue import SharedVariable
from pytensor.graph.basic import Constant, Variable, graph_inputs
from pytensor.tensor.random.op import RandomVariable
Expand Down Expand Up @@ -253,6 +253,14 @@ def __init__(
)
inputs = grad_vars

# If default C-backend mode, create function without gc
if (
"mode" not in kwargs
and pytensor.config.mode == "Mode"
and pytensor.config.linker == "cvm"
and pytensor.config.optimizer == "o4"
):
kwargs["mode"] = Mode(linker="cvm_nogc", optimizer="o4")
self._pytensor_function = compile_pymc(inputs, outputs, givens=givens, **kwargs)
self._raveled_inputs = ravel_inputs

Expand Down

0 comments on commit cb8d51e

Please sign in to comment.