Skip to content

Commit de74ff6

Browse files
ricardoV94twiecki
authored andcommitted
Update dependency to aesara 2.0.8, and necessary fixes
1 parent 2c372ef commit de74ff6

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

pymc3/distributions/dist_math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def rho2sigma(rho):
198198
"""
199199
`rho -> sigma` Aesara converter
200200
:math:`mu + sigma*e = mu + log(1+exp(rho))*e`"""
201-
return at.nnet.softplus(rho)
201+
return at.softplus(rho)
202202

203203

204204
rho2sd = rho2sigma

pymc3/distributions/transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class LogExpM1(ElemwiseTransform):
149149
name = "log_exp_m1"
150150

151151
def backward(self, rv_var, rv_value):
152-
return at.nnet.softplus(rv_value)
152+
return at.softplus(rv_value)
153153

154154
def forward(self, rv_var, rv_value):
155155
"""Inverse operation of softplus.
@@ -160,7 +160,7 @@ def forward(self, rv_var, rv_value):
160160
return at.log(1.0 - at.exp(-rv_value)) + rv_value
161161

162162
def jacobian_det(self, rv_var, rv_value):
163-
return -at.nnet.softplus(-rv_value)
163+
return -at.softplus(-rv_value)
164164

165165

166166
log_exp_m1 = LogExpM1()
@@ -191,7 +191,7 @@ def backward(self, rv_var, rv_value):
191191
a, b = self.param_extract_fn(rv_var)
192192

193193
if a is not None and b is not None:
194-
sigmoid_x = at.nnet.sigmoid(rv_value)
194+
sigmoid_x = at.sigmoid(rv_value)
195195
return sigmoid_x * b + (1 - sigmoid_x) * a
196196
elif a is not None:
197197
return at.exp(rv_value) + a
@@ -215,7 +215,7 @@ def jacobian_det(self, rv_var, rv_value):
215215
a, b = self.param_extract_fn(rv_var)
216216

217217
if a is not None and b is not None:
218-
s = at.nnet.softplus(-rv_value)
218+
s = at.softplus(-rv_value)
219219
return at.log(b - a) - 2 * s - rv_value
220220
else:
221221
return rv_value

pymc3/math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
or_,
5959
prod,
6060
sgn,
61+
sigmoid,
6162
sin,
6263
sinh,
6364
sqr,
@@ -78,7 +79,6 @@
7879

7980

8081
from aesara.tensor.nlinalg import det, matrix_dot, matrix_inverse, trace
81-
from aesara.tensor.nnet import sigmoid
8282
from scipy.linalg import block_diag as scipy_block_diag
8383

8484
from pymc3.aesaraf import floatX, ix_, largest_common_dtype
@@ -229,7 +229,7 @@ def log1pexp(x):
229229
230230
This function is numerically more stable than the naive approach.
231231
"""
232-
return at.nnet.softplus(x)
232+
return at.softplus(x)
233233

234234

235235
def log1mexp(x):

pymc3/variational/flows.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ def make_uw(self, u, w):
390390
# u_: d
391391
# w_: d
392392
wu = u.dot(w) # .
393-
mwu = -1.0 + at.nnet.softplus(wu) # .
393+
mwu = -1.0 + at.softplus(wu) # .
394394
# d + (. - .) * d / .
395395
u_h = u + (mwu - wu) * w / ((w ** 2).sum() + 1e-10)
396396
return u_h, w
397397
else:
398398
# u_: bxd
399399
# w_: bxd
400400
wu = (u * w).sum(-1, keepdims=True) # bx-
401-
mwu = -1.0 + at.nnet.softplus(wu) # bx-
401+
mwu = -1.0 + at.softplus(wu) # bx-
402402
# bxd + (bx- - bx-) * bxd / bx- = bxd
403403
u_h = u + (mwu - wu) * w / ((w ** 2).sum(-1, keepdims=True) + 1e-10)
404404
return u_h, w
@@ -507,7 +507,7 @@ def __init__(self, **kwargs):
507507

508508
def make_ab(self, a, b):
509509
a = at.exp(a)
510-
b = -a + at.nnet.softplus(b)
510+
b = -a + at.softplus(b)
511511
return a, b
512512

513513

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
aesara>=2.0.5
1+
aesara>=2.0.8
22
arviz>=0.11.2
33
cachetools>=4.2.1
44
dill

0 commit comments

Comments
 (0)