@@ -177,7 +177,7 @@ def _contains_cycle(fgraph, orderings):
177177
178178def _build_droot_impact (destroy_handler ):
179179 droot = {} # destroyed view + nonview variables -> foundation
180- impact = {} # destroyed nonview variable -> it + all views of it
180+ # impact = {} # destroyed nonview variable -> it + all views of it
181181 root_destroyer = {} # root -> destroyer apply
182182
183183 for app in destroy_handler .destroyers :
@@ -202,24 +202,26 @@ def _build_droot_impact(destroy_handler):
202202
203203 # The code here add all the variables that are views of r into
204204 # an OrderedSet input_impact
205- input_impact = OrderedSet ()
205+ # input_impact = OrderedSet()
206206
207207 q = deque ()
208208 q .append (input_root )
209+ view_o = destroy_handler .view_o
209210 while len (q ) > 0 :
210211 v = q .popleft ()
211- for n in destroy_handler .view_o .get (v , []):
212- input_impact .add (n )
212+ for n in view_o .get (v , []):
213+ droot [n ] = input_root
214+ # input_impact.add(n)
213215 q .append (n )
214216
215- for v in input_impact :
216- assert v not in droot
217- droot [v ] = input_root
217+ # for v in input_impact:
218+ # assert v not in droot
219+ # droot[v] = input_root
218220
219- impact [input_root ] = input_impact
220- impact [input_root ].add (input_root )
221+ # impact[input_root] = input_impact
222+ # impact[input_root].add(input_root)
221223
222- return droot , impact , root_destroyer
224+ return droot , root_destroyer
223225
224226
225227def inplace_candidates (fgraph , inputs , protected_inputs = None ):
@@ -336,15 +338,10 @@ def __init__(self, do_imports_on_attach=True, algo=None):
336338 self .droot = {}
337339
338340 """
339- Maps a variable to all variables that are indirect or direct views of it
341+ Maps a "foundation" destroyed variable to all variables that are indirect or direct views of it
340342 (including itself) essentially the inverse of droot.
341- TODO: do all variables appear in this dict, or only those that are
342- foundations?
343- TODO: do only destroyed variables go in here? one old docstring said so.
344- TODO: rename to x_to_views after reverse engineering what x is
345-
346343 """
347- self .impact = {}
344+ # self.impact = {}
348345
349346 """
350347 If a var is destroyed, then this dict will map
@@ -454,9 +451,9 @@ def refresh_droot_impact(self):
454451
455452 """
456453 if self .stale_droot :
457- self .droot , self .impact , self . root_destroyer = _build_droot_impact (self )
454+ self .droot , self .root_destroyer = _build_droot_impact (self )
458455 self .stale_droot = False
459- return self .droot , self .impact , self . root_destroyer
456+ return self .droot , self .root_destroyer
460457
461458 def on_detach (self , fgraph ):
462459 if fgraph is not self .fgraph :
0 commit comments