Skip to content

Commit 261862d

Browse files
ricardoV94twiecki
authored andcommitted
Fix auto-naming of multi-output logprobs
1 parent 5b68edc commit 261862d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pymc/logprob/abstract.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@ def _logprob_helper(rv, *values, **kwargs):
6767
"""Helper that calls `_logprob` dispatcher."""
6868
logprob = _logprob(rv.owner.op, values, *rv.owner.inputs, **kwargs)
6969

70-
for rv in values:
71-
if rv.name:
72-
logprob.name = f"{rv.name}_logprob"
73-
break
70+
name = rv.name
71+
if (not name) and (len(values) == 1):
72+
name = values[0].name
73+
if name:
74+
if isinstance(logprob, (list, tuple)):
75+
for i, term in enumerate(logprob):
76+
term.name = f"{name}_logprob.{i}"
77+
else:
78+
logprob.name = f"{name}_logprob"
7479

7580
return logprob
7681

0 commit comments

Comments
 (0)