

def orderings(self, fgraph):
    '\n        Return orderings induced by destructive operations.\n\n        Raise InconsistencyError when\n        a) attempting to destroy indestructable variable, or\n        b) attempting to destroy a value multiple times, or\n        c) an Apply destroys (illegally) one of its own inputs by aliasing\n\n        '
    rval = OrderedDict()
    if self.destroyers:
        (droot, impact, __ignore) = self.refresh_droot_impact()
        illegal_destroy = [r for r in droot if (getattr(r.tag, 'indestructible', False) or isinstance(r, graph.Constant))]
        if illegal_destroy:
            raise InconsistencyError(('Attempting to destroy indestructible variables: %s' % illegal_destroy))
        for app in self.destroyers:
            for (output_idx, input_idx_list) in iteritems(app.op.destroy_map):
                destroyed_idx = input_idx_list[0]
                destroyed_variable = app.inputs[destroyed_idx]
                root = droot[destroyed_variable]
                root_impact = impact[root]
                tolerate_same = getattr(app.op, 'destroyhandler_tolerate_same', [])
                assert isinstance(tolerate_same, list)
                tolerated = OrderedSet((idx1 for (idx0, idx1) in tolerate_same if (idx0 == destroyed_idx)))
                tolerated.add(destroyed_idx)
                tolerate_aliased = getattr(app.op, 'destroyhandler_tolerate_aliased', [])
                assert isinstance(tolerate_aliased, list)
                ignored = OrderedSet((idx1 for (idx0, idx1) in tolerate_aliased if (idx0 == destroyed_idx)))
                for (i, input) in enumerate(app.inputs):
                    if (i in ignored):
                        continue
                    if ((input in root_impact) and ((i not in tolerated) or (input is not destroyed_variable))):
                        raise InconsistencyError(('Input aliasing: %s (%i, %i)' % (app, destroyed_idx, i)))
                root_clients = OrderedSet()
                for r in root_impact:
                    assert (not [a for (a, c) in self.clients[r].items() if (not c)])
                    root_clients.update([a for (a, c) in self.clients[r].items() if c])
                root_clients.remove(app)
                if root_clients:
                    rval[app] = root_clients
    return rval

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/gof/destroyhandler.py DestroyHandler.orderings/original