Skip to content

Commit 904bfb7

Browse files
committed
ret
1 parent d7c15ed commit 904bfb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnx_diagnostic/torch_export_patches/patch_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def _rewrite_if(self, node, then_exprs, else_exprs, tgt_mapping=None):
7070
then_ret, else_ret = None, None
7171
if tgt_mapping is None and len(then_exprs) == 1 and len(else_exprs) == 1:
7272
# return
73-
then_exprs = [n for n in node.body if not isinstance(n, ast.Return)]
74-
else_exprs = [n for n in node.orelse if not isinstance(n, ast.Return)]
7573
then_ret = then_exprs[0]
7674
else_ret = else_exprs[0]
75+
then_exprs = [n for n in node.body if not isinstance(n, ast.Return)]
76+
else_exprs = [n for n in node.orelse if not isinstance(n, ast.Return)]
7777
else:
7878
assert tgt_mapping, (
7979
f"then and else branchs do not have the same number "

0 commit comments

Comments
 (0)