Skip to content

Commit 3a62aec

Browse files
authored
fixes inference case when elbo is positive (#2092)
1 parent e488d69 commit 3a62aec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pymc3/variational/opvi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def __call__(self, z):
271271
sequences=z, n_steps=z.shape[0])[0].mean()
272272
else:
273273
a = theano.clone(self.op.apply(self.tf), {self.op.input: z}, strict=False)
274-
return tt.abs_(a)
274+
return self.op.T(a)
275275

276276

277277
class Operator(object):
@@ -291,6 +291,7 @@ class Operator(object):
291291
RETURNS_LOSS = True
292292
SUPPORT_AEVB = True
293293
OBJECTIVE = ObjectiveFunction
294+
T = pm.theanof.identity
294295

295296
def __init__(self, approx):
296297
if not self.SUPPORT_AEVB and approx.local_vars:
@@ -334,9 +335,9 @@ def apply(self, f): # pragma: no cover
334335
335336
Parameters
336337
----------
337-
f : function or None
338+
f : TestFunction or None if not required
338339
function that takes `z = self.input` and returns
339-
same dimension output
340+
same dimensional output
340341
341342
Returns
342343
-------

0 commit comments

Comments
 (0)