def gen_function(func_attrs: Dict[str, Any]) -> str:
    """
    Parameters
    ----------
    func_attrs : Dict[str, Any]
        Attributes from Operator

    Returns
    -------
    str
        Source code for function generated.
    """

    func_name = func_attrs["name"]
    x = func_attrs["inputs"][0]
    rank = x._rank()

    custom_libs = Target.current().get_custom_libs(
        os.path.dirname(__file__), "permute.cuh"
    )
    dtype = x.dtype()
    assert dtype in (
        "float16",
        "bfloat16",
        "float32",
        "float",
    ), "permute is only tested for floating point type"
    backend_type = CUDASpec().dtype_to_backend_dtype[dtype]
    return SRC_TEMPLATE.render(
        func_name=func_name,
        custom_libs=custom_libs,
        input_rank=rank,
        elem_type=backend_type,
    )
Parameters
----------
func_attrs : Dict[str, Any]
Attributes from Operator

Returns
-------
str
Source code for function generated.
python/aitemplate/backend/cuda/tensor/permute.py