def gen_int_var(
    values: List[int], name: str = None, symbolic_value: Optional[sympy.Basic] = None
):
    """
    A helper function to generate IntImm or IntVar depending on the length of values.
    """
    from aitemplate.compiler.base import IntImm, IntVar

    values = list(set(values))
    if len(values) == 1:
        return IntImm(values[0], name=name)
    elif len(values) > 1:
        return IntVar(values, name=name, symbolic_value=symbolic_value)
    else:
        raise RuntimeError("Unsupported dim definition: {}".format(values))
A helper function to generate IntImm or IntVar depending on the length of values.
python/aitemplate/utils/shape_utils.py