def compose_getitem_slice(
    module: torch.fx.GraphModule,
) -> torch.fx.GraphModule:
    """
    combine decomposed getitem(input, idx=(slice(),slice()...))
    """

    def match_pattern(module, node):
        if node.op == "call_function" and node.target == torch.ops.aten.slice.Tensor:
            holder = []
            holder.append(node)
            qualified = True
            user_change_input = []

            while qualified:
                next_user = None
                for user in node.users:
                    if (
                        user.target == torch.ops.aten.slice.Tensor
                        and node.args[1] + 1 == user.args[1]
                    ):
                        next_user = user
                    elif (
                        user.target == torch.ops.aten.sym_size
                        and user.args[1] == node.args[1]
                    ):
                        user_change_input.append(user)
                    else:
                        qualified = False
                        break
                if qualified and next_user:
                    node = next_user
                    holder.append(node)
                else:
                    qualified = False

            if len(holder) == 1:
                return (False,)
            else:
                return (True, holder, user_change_input)
        return (False,)

    modified = False
    for node in module.graph.nodes:
        res = match_pattern(module, node)
        if res[0]:
            modified = True
            holder = res[1]
            user_change_input = res[2]
            input_n = holder[0].args[0]
            last_n = holder[-1]
            list_args = []
            for h_n in holder:
                list_args.append(h_n.args[1:])

            with module.graph.inserting_after(last_n):
                new_args = (input_n, list_args)
                new_node = module.graph.create_node(
                    "call_function",
                    aten_compose_getitem_slice,
                    args=tuple(new_args),
                    kwargs=None,
                )
            last_n.replace_all_uses_with(new_node)
            for n in user_change_input:
                new_args = list(n.args)
                new_args[0] = new_node
                n.args = tuple(new_args)

    module.graph.eliminate_dead_code()
    module.recompile()
    return PassResult(module, modified)

    combine decomposed getitem(input, idx=(slice(),slice()...))
    
fx2ait/fx2ait/passes/lower_basic_pass_aten.py