@@ -129,16 +129,18 @@ def sort_operators_topologically(self):
129129 If it fails (e.g. due to an invalid graph), a warning is logged and the original operator order is preserved.
130130 """
131131
132+ operators = self .get_operators ()
133+
132134 # Map tensors to operators that produce them.
133135 tensor_to_producer_op = {}
134- for producer_op in self . get_operators () :
136+ for producer_op in operators :
135137 for output in producer_op .tmp_outputs :
136138 tensor_to_producer_op [output ] = producer_op
137139
138140 # Map operators to operators that consume their outputs.
139141 op_to_child_op = defaultdict (list )
140- num_unresolved_input_dependencies = {op : 0 for op in self . get_operators () }
141- for child_op in self . get_operators () :
142+ num_unresolved_input_dependencies = {op : 0 for op in operators }
143+ for child_op in operators :
142144 for input_ in child_op .tmp_inputs :
143145 parent_op = tensor_to_producer_op .get (input_ )
144146 if parent_op is not None :
@@ -163,14 +165,14 @@ def sort_operators_topologically(self):
163165 # insert it into the graph.
164166 queue .append (child_op )
165167
166- if len (sorted_ops ) != self . get_operators () .len ():
168+ if len (sorted_ops ) != operators .len ():
167169 logging .warning (
168170 "NXP backend: ModelBuilder.sort_operators_topologically() failed. Please report this."
169171 )
170172
171173 else :
172174 # The topological sort was successful.
173- self . get_operators () .vector = sorted_ops
175+ operators .vector = sorted_ops
174176
175177 def create_zeros_tensor (
176178 self , dims : List [int ], name : str , dtype : np .dtype , can_reuse : bool = False
0 commit comments