提交 45304915 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Adjust the mask and constant for float16 random so that we get closer to 1.0.

上级 424c3a40
...@@ -791,10 +791,10 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base): ...@@ -791,10 +791,10 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
if self.output_type.dtype == 'float16': if self.output_type.dtype == 'float16':
otype = 'ga_half' otype = 'ga_half'
# limit the values of the state that we use. # limit the values of the state that we use.
mask = '& 0xffff' mask = '& 0x7fff'
NORM = '1.5199e-05f' # numpy.float16(1.0/(2**16+130)) NORM = '3.0518e-05f' # numpy.float16(1.0/(2**15+8))
# this was determined by finding the biggest number such that # this was determined by finding the biggest number such that
# numpy.float16(number * (M1 & 0xffff)) < 1.0 # numpy.float16(number * (M1 & 0x7fff)) < 1.0
elif self.output_type.dtype == 'float32': elif self.output_type.dtype == 'float32':
otype = 'float' otype = 'float'
mask = '' mask = ''
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论