def exists_path()

in understanding_rl_vision/rl_clarity/interface.py [0:0]


def exists_path(model, *, from_names, to_names, without_names=[]):
    for from_name in from_names:
        if from_name not in without_names:
            if from_name in to_names:
                return True
            next_names = [
                name.rsplit(":", 1)[0]
                for node in model.graph_def.node
                if node.name == from_name
                for name in node.input
            ]
            if exists_path(
                model,
                from_names=next_names,
                to_names=to_names,
                without_names=without_names,
            ):
                return True
    return False