提交 b0886305 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Do not enter an infinite loop

If there is no room for even 2 inputs, then it will fail rather than loop endlessly.
上级 f7cea417
...@@ -755,8 +755,9 @@ def local_gpua_elemwise(op, context_name, inputs, outputs): ...@@ -755,8 +755,9 @@ def local_gpua_elemwise(op, context_name, inputs, outputs):
return [gpu_output] return [gpu_output]
elif op.scalar_op in (scalar.add, scalar.mul): elif op.scalar_op in (scalar.add, scalar.mul):
max_nb_inputs = max_inputs_to_GpuElemwise(outputs) max_nb_inputs = max_inputs_to_GpuElemwise(outputs)
while len(inputs) > max_nb_inputs: if max_nb_inputs > 1:
inputs = inputs[:-max_nb_inputs] + [res(*inputs[-max_nb_inputs:])] while len(inputs) > max_nb_inputs:
inputs = inputs[:-max_nb_inputs] + [res(*inputs[-max_nb_inputs:])]
return res(*inputs) return res(*inputs)
else: else:
return res return res
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论