def replacement_pattern_abstract(replacement):
    """
    Replace the pattern graph by a node of call_function of this `replacement`
    """
    traced = symbolic_trace(replacement)
    replacement_placeholders = [
        node for node in traced.graph.nodes if node.op == "placeholder"
    ]
    for n in traced.graph.nodes:
        if n.op == "output":
            before_output = n.all_input_nodes[0]
            with traced.graph.inserting_after(before_output):
                new_args = tuple(replacement_placeholders)
                new_node = traced.graph.create_node(
                    "call_function",
                    replacement,
                    args=new_args,
                    kwargs=None,
                )
                before_output.replace_all_uses_with(new_node)
    traced.graph.eliminate_dead_code()
    traced.recompile()
    return traced
Replace the pattern graph by a node of call_function of this `replacement`
fx2ait/fx2ait/passes/lower_basic_pass_aten.py