提交 52080345 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

fixed the segfault fix

上级 4d704f38
...@@ -321,8 +321,15 @@ class Broadcast(Op, Destroyer): ...@@ -321,8 +321,15 @@ class Broadcast(Op, Destroyer):
# the second calling form is used because in certain versions of numpy # the second calling form is used because in certain versions of numpy
# the first (faster) version leads to segfaults # the first (faster) version leads to segfaults
ufunc_args = [input.data for input in self.inputs]# + output_storage ufunc_args = [input.data for input in self.inputs]# + output_storage
#self.ufunc(*(ufunc_args+output_storage)) results = self.ufunc(*ufunc_args)
output_storage[0][:] = self.ufunc(*ufunc_args) if self.ufunc.nout == 1: results = [results]
for result, storage in zip(results, output_storage):
if storage.shape:
storage[:] = result
else:
storage.itemset(result)
# the following should be used instead of the previous loop, unfortunately it tends to segfault
# self.ufunc(*(ufunc_args+output_storage))
def _c_all(self, inames, onames, sub): def _c_all(self, inames, onames, sub):
_inames = inames _inames = inames
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论