Skip to content

Commit cf7c56e

Browse files
committed
[ChanLast] don't remove opposing transposes if first one is forking
1 parent 16826a6 commit cf7c56e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/qonnx/transformation/channels_last.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ def apply(self, model):
301301
ndim = len(input_shape)
302302
if list(to_channels_first_args(ndim)) == perm_1:
303303
successor_nodes = model.find_direct_successors(n)
304-
if successor_nodes is None:
304+
# skip if:
305+
# - this Transpose has no successors (nothing to do)
306+
# - this Transpose output is forking (cannot remove)
307+
if successor_nodes is None or len(successor_nodes) > 1:
305308
continue
306309
successor_node = successor_nodes[0]
307310

0 commit comments

Comments
 (0)