Skip to content

Commit

Permalink
Do not allow logp_dlogp_function to receive RVs
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Sep 22, 2021
1 parent 1b2afa0 commit cc08cf1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pymc3/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,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:
Expand Down

0 comments on commit cc08cf1

Please sign in to comment.