def __call__()

in optimum/onnxruntime/preprocessors/passes/excluders.py [0:0]


    def __call__(self, graph: ModelProto, model: OnnxModel) -> Tuple[Set[str], Set[str]]:
        # Find out the nodes to exclude in the graph
        candidate_nodes_to_exclude = {
            candidate_input: candidate.name
            for candidate in model.get_nodes_by_op_type(self.operator_type_to_exclude)
            for candidate_input in candidate.input
        }

        parent_node = {
            node_output: node.name
            for node in model.get_nodes_by_op_type(self.parent_operator_type)
            for node_output in node.output
        }

        # Intersection of both are the one we want to remove
        to_exclude = set(candidate_nodes_to_exclude.keys()).intersection(parent_node.keys())
        nodes_to_exclude = {candidate_nodes_to_exclude[node] for node in to_exclude}

        return set(), nodes_to_exclude