Skip to content

Commit baac03e

Browse files
committed
Fix transpose optimizer when handling "if" operator subgraphs
1 parent 9040acc commit baac03e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tf2onnx/optimizer/transpose_optimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ def _handle_nhwc_tranpose(self, trans):
282282
return False
283283
# move transpose into branches to let Transposes can be "handled" in each branch
284284
for n in out_nodes:
285-
branch_trans = self._g.make_node("Transpose", [trans.input[0]], attr=trans.attr_onnx)
286-
self._g.replace_input(n, trans.output[0], branch_trans.output[0])
285+
branch_trans = n.graph.make_node("Transpose", [trans.input[0]], attr=trans.attr_onnx)
286+
n.graph.replace_input(n, trans.output[0], branch_trans.output[0])
287287

288288
self._g.remove_node(trans.name)
289289
return False

0 commit comments

Comments
 (0)