Skip to content

Commit

Permalink
Fix auto-naming of multi-output logprobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 authored and twiecki committed Jun 5, 2023
1 parent 5b68edc commit 261862d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pymc/logprob/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ def _logprob_helper(rv, *values, **kwargs):
"""Helper that calls `_logprob` dispatcher."""
logprob = _logprob(rv.owner.op, values, *rv.owner.inputs, **kwargs)

for rv in values:
if rv.name:
logprob.name = f"{rv.name}_logprob"
break
name = rv.name
if (not name) and (len(values) == 1):
name = values[0].name
if name:
if isinstance(logprob, (list, tuple)):
for i, term in enumerate(logprob):
term.name = f"{name}_logprob.{i}"
else:
logprob.name = f"{name}_logprob"

return logprob

Expand Down

0 comments on commit 261862d

Please sign in to comment.