

def _build_droot_impact(destroy_handler):
    droot = {
        
    }
    impact = {
        
    }
    root_destroyer = {
        
    }
    for app in destroy_handler.destroyers:
        for (output_idx, input_idx_list) in app.op.destroy_map.items():
            if (len(input_idx_list) != 1):
                raise NotImplementedError()
            input_idx = input_idx_list[0]
            input = app.inputs[input_idx]
            view_i = destroy_handler.view_i
            _r = input
            while (_r is not None):
                r = _r
                _r = view_i.get(r)
            input_root = r
            if (input_root in droot):
                raise InconsistencyError(('Multiple destroyers of %s' % input_root))
            droot[input_root] = input_root
            v[input_root] = app
            input_impact = OrderedSet()
            queue = Queue()
            queue.put(input_root)
            while (not queue.empty()):
                v = queue.get()
                for n in destroy_handler.view_o.get(v, []):
                    input_impact.add(n)
                    queue.put(n)
            for v in input_impact:
                assert (v not in droot)
                droot[v] = input_root
            impact[input_root] = input_impact
            impact[input_root].add(input_root)
    return (droot, impact, root_destroyer)

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/gof/destroyhandler.py _build_droot_impact/VarMisuse@158/238 `root_destroyer`->`v`