From b9f225b99e54f5bb480c3ffdab341351f0ca7f6b Mon Sep 17 00:00:00 2001 From: ricardoV94 Date: Wed, 22 Sep 2021 02:59:42 +0200 Subject: [PATCH] Do not allow logp_dlogp_function to receive RVs --- pymc3/model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pymc3/model.py b/pymc3/model.py index 5b41d83a396..3428846fa8a 100644 --- a/pymc3/model.py +++ b/pymc3/model.py @@ -702,14 +702,11 @@ def logp_dlogp_function(self, grad_vars=None, tempered=False, **kwargs): `alpha` can be changed using `ValueGradFunction.set_weights([alpha])`. """ if grad_vars is None: - grad_vars = [v.tag.value_var for v in typefilter(self.free_RVs, continuous_types)] + grad_vars = [self.rvs_to_values[v] for v in typefilter(self.free_RVs, continuous_types)] else: for i, var in enumerate(grad_vars): if var.dtype not in continuous_types: raise ValueError(f"Can only compute the gradient of continuous types: {var}") - # We allow one to pass the random variable terms as arguments - if hasattr(var.tag, "value_var"): - grad_vars[i] = var.tag.value_var if tempered: with self: