提交 fefdb397 authored 作者: Frederic Bastien's avatar Frederic Bastien

don't let the mrg random generator for normal distribution upcast float32 to float64

上级 d56de3e6
...@@ -684,8 +684,8 @@ class MRG_RandomStreams(object): ...@@ -684,8 +684,8 @@ class MRG_RandomStreams(object):
#normal_samples[n_samples/2:] = sqrt_ln_U1 * sin(2.0*numpy.pi*U2) #normal_samples[n_samples/2:] = sqrt_ln_U1 * sin(2.0*numpy.pi*U2)
# so trying this instead # so trying this instead
first_half = sqrt_ln_U1 * cos(2.0*numpy.pi*U2) first_half = sqrt_ln_U1 * cos(2.0*cast(numpy.pi,dtype)*U2)
second_half = sqrt_ln_U1 * sin(2.0*numpy.pi*U2) second_half = sqrt_ln_U1 * sin(2.0*cast(numpy.pi,dtype)*U2)
normal_samples = join(0, first_half, second_half) normal_samples = join(0, first_half, second_half)
final_samples = None final_samples = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论