提交 69b7e924 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make sure we don't use the float64 values for ScalarSoftplus when working on float16.

上级 5cd4e44e
...@@ -320,7 +320,8 @@ class ScalarSoftplus(scalar.UnaryScalarOp): ...@@ -320,7 +320,8 @@ class ScalarSoftplus(scalar.UnaryScalarOp):
def c_code(self, node, name, inp, out, sub): def c_code(self, node, name, inp, out, sub):
x, = inp x, = inp
z, = out z, = out
if node.inputs[0].type == scalar.float32: if (node.inputs[0].type == scalar.float32 or
node.inputs[0].type == scalar.float16):
# These constants were obtained by looking at the output of python commands like: # These constants were obtained by looking at the output of python commands like:
# for i in xrange(750): # for i in xrange(750):
# print i, repr( numpy.log1p(numpy.exp(theano._asarray([i,-i], dtype=dt)))) # print i, repr( numpy.log1p(numpy.exp(theano._asarray([i,-i], dtype=dt))))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论