def gen_function(
    func_attrs,
    exec_cond_template,
    dim_info_dict,
    gemm_flag,
    problem_args_template=None,
    extra_header_template=None,
    extra_shape_template=EXTRA_SHAPE_TEMPLATE,
    extra_code="",
    input_addr_calculator="",
    output_addr_calculator="",
):
    """Generate function body.

    Parameters
    ----------
    func_attrs : Dict
        Operation attributes.
    exec_cond_template : jinja2.Template
        Generates if statement to execute kernel.
    dim_info_dict: Dict[str, DimInfo]
        Generated from gemm._extract_dims().
        Used to store mapping between dim_names to input / output tensor dims.
    gemm_flag : str
        Flag telling which backend should be generated. options are '','bias','bias_relu','bias_add_relu'.
    extra_code : str
        Extra code for self-defined operators.
    input_addr_calculator : str
        Used to adjust input address based on input tensor accessors if accessors exist
    output_addr_calculator : str
        Used to adjust output address based on output tensor accessors if accessors exist


    Returns
    -------
    str
        The rendered template of generated function body.
    """
    if problem_args_template is None:
        if gemm_flag == "":
            problem_args_template = PROBLEM_ARGS_TEMPLATE
        else:
            problem_args_template = PROBLEM_ARGS_TEMPLATE_MULTI_D

    if extra_header_template is None:
        if gemm_flag == "":
            extra_header_template = EXTRA_HEADER_TEMPLATE
        else:
            extra_header_template = EXTRA_HEADER_TEMPLATE_MULTI_D

    return common.gen_function(
        func_attrs,
        exec_cond_template,
        dim_info_dict,
        gemm_flag,
        extra_code=extra_code,
        ndims=3,
        extra_shape_template=extra_shape_template,
        problem_args_template=problem_args_template,
        extra_header_template=extra_header_template,
        input_addr_calculator=input_addr_calculator,
        output_addr_calculator=output_addr_calculator,
    )
Generate function body.

Parameters
----------
func_attrs : Dict
Operation attributes.
exec_cond_template : jinja2.Template
Generates if statement to execute kernel.
dim_info_dict: Dict[str, DimInfo]
Generated from gemm._extract_dims().
Used to store mapping between dim_names to input / output tensor dims.
gemm_flag : str
Flag telling which backend should be generated. options are '','bias','bias_relu','bias_add_relu'.
extra_code : str
Extra code for self-defined operators.
input_addr_calculator : str
Used to adjust input address based on input tensor accessors if accessors exist
output_addr_calculator : str
Used to adjust output address based on output tensor accessors if accessors exist


Returns
-------
str
The rendered template of generated function body.
python/aitemplate/backend/rocm/gemm/bmm_common.py