Skip to content

Commit 53c56da

Browse files
committed
prevent multi-transpose on pad
1 parent fdabeea commit 53c56da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tf2onnx/optimizer/transpose_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def _pad_handler(self, trans, node):
556556
new_pads = [pads[0], pads[3], pads[1], pads[2], pads[4], pads[7], pads[5], pads[6]]
557557
node.set_attr("pads", new_pads)
558558
return self._switch_transpose_and_node(node, trans)
559-
if node.inputs[1].is_const():
559+
if node.inputs[1].is_const() and self._nodes_has_single_consumer_node([node.inputs[1]]):
560560
pads = node.inputs[1].get_tensor_value()
561561
# NHWC->NCHW
562562
new_pads = np.array([pads[0], pads[3], pads[1], pads[2], pads[4], pads[7], pads[5], pads[6]],

0 commit comments

Comments
 (0)