提交 d6122e96 authored 作者: Frederic's avatar Frederic

Fix error in debugmode, int64 and longlong typenum aren't the same even for the same dtype.

上级 3bebee7a
...@@ -870,6 +870,13 @@ class Elemwise(OpenMPOp): ...@@ -870,6 +870,13 @@ class Elemwise(OpenMPOp):
elif (not isinstance(variable, numpy.ndarray) or elif (not isinstance(variable, numpy.ndarray) or
variable.dtype != nout.dtype): variable.dtype != nout.dtype):
variable = numpy.asarray(variable, nout.dtype) variable = numpy.asarray(variable, nout.dtype)
# The next line is needed for numpy 1.9. Otherwise
# there are tests that fail in DebugMode.
# Normally we would call theano.misc._asarray, but it
# is faster to inline the code. We know that the dtype
# are the same string, just different typenum.
if numpy.dtype(nout.dtype).num != variable.dtype.num:
variable = variable.view(dtype=nout.dtype)
storage[0] = variable storage[0] = variable
# numpy.real return a view! # numpy.real return a view!
elif not variable.flags.owndata: elif not variable.flags.owndata:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论