Skip to content

Commit

Permalink
added print_value function
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdivya1309 committed Feb 9, 2024
1 parent 2de0c23 commit b41805c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
from pytensor.compile import DeepCopyOp, get_mode
from pytensor.compile.sharedvalue import SharedVariable
from pytensor.graph.basic import Constant, Variable, graph_inputs
from pytensor.printing import Print
from pytensor.scalar import Cast
from pytensor.tensor.elemwise import Elemwise
from pytensor.tensor.random.op import RandomVariable
from pytensor.tensor.random.type import RandomType
from pytensor.tensor.sharedvar import ScalarSharedVariable
from pytensor.tensor.variable import TensorConstant, TensorVariable
from pytensor.printing import Print
from typing_extensions import Self

from pymc.blocking import DictToArrayBijection, RaveledVars
Expand Down Expand Up @@ -2247,10 +2247,11 @@ def normal_logp(value, mu, sigma):

return var


def print_value(var, name=None):
"""Print value of variable when it is computed during sampling.
This is likely to affect sampling performance.
"""
if name is None:
name = var.name
return Print(name)(var)
return Print(name)(var)

Check warning on line 2257 in pymc/model/core.py

View check run for this annotation

Codecov / codecov/patch

pymc/model/core.py#L2255-L2257

Added lines #L2255 - L2257 were not covered by tests

0 comments on commit b41805c

Please sign in to comment.