提交 9552e36c authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki

alloc is removed only if the new alloc does not drop any dimension

上级 be7831fc
......@@ -1704,8 +1704,8 @@ def local_useless_alloc(node):
num_dims_with_size_1_added_to_left += 1
else:
break
if num_dims_with_size_1_added_to_left > 0:
new_output_shape = output_shape[num_dims_with_size_1_added_to_left:]
if num_dims_with_size_1_added_to_left > 0 and len(new_output_shape) >= input.ndim:
inner = op(*([input] + new_output_shape))
dimshuffle_new_order = (['x'] * num_dims_with_size_1_added_to_left +
range(len(new_output_shape)))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论