def transform_special_ops(
    sorted_graph: List[Tensor], workdir: str = None
) -> List[Tensor]:
    """Transform generic gemm/conv ops to special ops.

    Parameters
    ----------
    sorted_graph : List[Tensor]
        Input graph
    workdir : str, optional
        workdir, by default None

    Returns
    -------
    List[Tensor]
        Transformed graph
    """
    funcs = [
        _transform_bmm_rcr_n1,
        _transform_gemm_rrr_small_nk,
    ]
    for func in funcs:
        sorted_graph = func(sorted_graph)

    # This pass doesn not always make the model run faster.
    # Turn it on with detect_target(transform_conv_to_gemm=True)
    funcs = [
        _transform_1x1_conv_gemm_rcr,
    ]

    from aitemplate.backend.target import Target

    if "convert_conv_to_gemm" in Target.current()._kwargs:
        if Target.current()._kwargs["convert_conv_to_gemm"]:
            for func in funcs:
                sorted_graph = func(sorted_graph)
    return sorted_graph
Transform generic gemm/conv ops to special ops.

    Parameters
    ----------
    sorted_graph : List[Tensor]
        Input graph
    workdir : str, optional
        workdir, by default None

    Returns
    -------
    List[Tensor]
        Transformed graph
    
python/aitemplate/compiler/transform/transform_special_ops.py