Skip to content

Commit

Permalink
Disable GC on logp_dlogp function
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Nov 23, 2024
1 parent 5cc5902 commit d6f9e14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 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,9 @@ def __init__(
)
inputs = grad_vars

# If default mode, create function without gc
if pytensor.config.mode == "FAST_RUN" and pytensor.config.cxx:
kwargs.setdefault("mode", Mode(linker="cvm_nogc", optimizer="fast_run"))
self._pytensor_function = compile_pymc(inputs, outputs, givens=givens, **kwargs)
self._raveled_inputs = ravel_inputs

Expand Down

0 comments on commit d6f9e14

Please sign in to comment.