Skip to content

Commit b1ede8a

Browse files
author
Junpeng Lao
committed
float32 error fix
fix py2.7 float 32 test error
1 parent f33a654 commit b1ede8a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pymc3/distributions/transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import theano.tensor as tt
22

33
from ..model import FreeRV
4-
from ..theanof import gradient
4+
from ..theanof import gradient, floatX
55
from . import distribution
66
from ..math import logit, invlogit
77
from .distribution import draw_values
@@ -139,7 +139,7 @@ def forward(self, x):
139139
def forward_val(self, x, point=None):
140140
a, b = draw_values([self.a, self.b],
141141
point=point)
142-
return tt.log(x - a) - tt.log(b - x)
142+
return floatX(tt.log(x - a) - tt.log(b - x))
143143

144144
def jacobian_det(self, x):
145145
s = tt.nnet.softplus(-x)
@@ -168,7 +168,7 @@ def forward(self, x):
168168
def forward_val(self, x, point=None):
169169
a = draw_values([self.a],
170170
point=point)[0]
171-
return tt.log(x - a)
171+
return floatX(tt.log(x - a))
172172

173173
def jacobian_det(self, x):
174174
return x
@@ -196,7 +196,7 @@ def forward(self, x):
196196
def forward_val(self, x, point=None):
197197
b = draw_values([self.b],
198198
point=point)[0]
199-
return tt.log(b - x)
199+
return floatX(tt.log(b - x))
200200

201201
def jacobian_det(self, x):
202202
return x

0 commit comments

Comments
 (0)