Skip to content

Commit 697bce0

Browse files
authored
Remove creation of duplicate value (#2775)
Remove creation of duplicate value when processing variables defined within a loop. Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
1 parent 5db32c0 commit 697bce0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

onnxscript/_internal/converter.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,13 +1271,12 @@ def _translate_loop_stmt(self, loop_stmt: ast.For | ast.While) -> None:
12711271
# TODO: retrieve the annotation for variable pv is any is specified.
12721272
# typeinfo = self._eval_constant_expr(pv.annotation)
12731273
typeinfo = None
1274-
self._current_fn.append_parameter(
1275-
make_value(onnx_var_name, typeinfo, self._source_of(loop_stmt))
1276-
)
1274+
parameter = make_value(onnx_var_name, typeinfo, self._source_of(loop_stmt))
1275+
self._current_fn.append_parameter(parameter)
12771276
self._bind(
12781277
pv,
12791278
values.SymbolValue(
1280-
ir.Value(name=onnx_var_name),
1279+
parameter,
12811280
self._source_of(loop_stmt),
12821281
),
12831282
)

0 commit comments

Comments
 (0)