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

In compute_test_values, do not let destructive op work on test values.

上级 e8b98aa2
...@@ -359,6 +359,15 @@ class PureOp(object): ...@@ -359,6 +359,15 @@ class PureOp(object):
# if all inputs have test-values, run the actual op # if all inputs have test-values, run the actual op
if run_perform: if run_perform:
# Original values should not be destroyed:
# copy the values of the inputs in destroy_map
destroyed_inputs_idx = []
if getattr(node.op, 'destroy_map', None):
for i_pos_list in node.op.destroy_map.itervalues():
destroyed_inputs_idx.extend(i_pos_list)
for i in destroyed_inputs_idx:
input_vals[i] = input_vals[i].copy()
# compute output value once with test inputs to validate graph # compute output value once with test inputs to validate graph
output_storage = [[None]] * len(node.outputs) output_storage = [[None]] * len(node.outputs)
try: try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论