提交 763a048a authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki 提交者: Pascal Lamblin

condition is now fixed

上级 74ee8c36
...@@ -4185,14 +4185,15 @@ def local_useless_reshape(node): ...@@ -4185,14 +4185,15 @@ def local_useless_reshape(node):
dimshuffle_new_order = [] dimshuffle_new_order = []
new_output_shape = [] new_output_shape = []
i = 0 # index over the output of the new reshape i = 0 # index over the output of the new reshape
for dim in output_shape.get_scalar_constant_value(): import ipdb; ipdb.set_trace()
for dim in extract_constant(output_shape, only_process_constants=True):
if dim == 1: if dim == 1:
dimshuffle_new_order.append('x') dimshuffle_new_order.append('x')
else: else:
dimshuffle_new_order.append(i) dimshuffle_new_order.append(i)
new_output_shape.append(dim) new_output_shape.append(dim)
i = i + 1 i = i + 1
if len(dimshuffle_new_order) > 0: if i != output.ndim:
inner = op.__class__(len(new_output_shape))(input, new_output_shape) inner = op.__class__(len(new_output_shape))(input, new_output_shape)
return [DimShuffle(inner.type.broadcastable, dimshuffle_new_order)(inner)] return [DimShuffle(inner.type.broadcastable, dimshuffle_new_order)(inner)]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论