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

Fix exception just introduced.

上级 4cf0f055
...@@ -868,15 +868,11 @@ class Elemwise(OpenMPOp): ...@@ -868,15 +868,11 @@ class Elemwise(OpenMPOp):
# always return an ndarray with dtype object # always return an ndarray with dtype object
variable = numpy.asarray(variable, dtype=nout.dtype) variable = numpy.asarray(variable, dtype=nout.dtype)
# The storage has been resized earlier. # Sometimes NumPy return a Python type.
if hasattr(variable, 'shape'): if not isinstance(variable, numpy.ndarray):
assert storage[0].shape == variable.shape variable = numpy.asarray(variable, nout.dtype)
else:
# If variable has not shape, then it is a scalar.
assert numpy.prod(storage[0].shape) == 1
storage[0][...] = variable storage[0] = variable
assert str(storage[0].dtype) != 'object'
# the following should be used instead of the previous loop, # the following should be used instead of the previous loop,
# unfortunately it tends to segfault # unfortunately it tends to segfault
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论