提交 05f4df68 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

corrected Broadcast.perform behavior to always return a fresh array

上级 f103345f
...@@ -216,12 +216,12 @@ class Broadcast(Op, Destroyer): ...@@ -216,12 +216,12 @@ class Broadcast(Op, Destroyer):
output_storage = [] output_storage = []
if not self.inplace_pattern: if not self.inplace_pattern:
for output in self.outputs: for output in self.outputs:
odat = output.data # odat = output.data
shape = [max(values) for values in zip(*[input.data.shape for input in self.inputs])] shape = [max(values) for values in zip(*[input.data.shape for input in self.inputs])]
if odat is not None: # if odat is not None:
odat.resize(shape) # odat.resize(shape)
else: # else:
odat = numpy.ndarray(shape, dtype = output.dtype) odat = numpy.ndarray(shape, dtype = output.dtype)
output_storage.append(odat) output_storage.append(odat)
output.data = odat output.data = odat
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论