diff --git a/src/finn/transformation/general.py b/src/finn/transformation/general.py index 4303eb17f39a9949f5729e895e449bbb6a633033..690364a7d827086217ffdf9d246c2f4c5f395772 100644 --- a/src/finn/transformation/general.py +++ b/src/finn/transformation/general.py @@ -189,6 +189,9 @@ class SortGraph(Transformation): # Probably this is faster than copying initializers and more robust in general def apply(self, model): + if len(model.graph.node) == 1: + # single-node graph, nothing to sort + return (model, False) # Gather graph structure graph_dependencies = {} node_list = [ @@ -214,7 +217,7 @@ class SortGraph(Transformation): for new_idx, sorted_idx in enumerate(sorted_node_indexes): model.graph.node.insert(new_idx, node_list[sorted_idx]) - return model, False + return (model, False) class ConvertSubToAdd(Transformation):