def convert_shape_to_IntVar(shape):
    """
    Helper function to convert a list of mixed int/IntVar/IntImm
    into a list with only IntVar/IntImm.
    """
    from aitemplate.compiler.base import IntImm, IntVar, IntVarTensor

    ret = []
    for v in shape:
        if isinstance(v, int):
            ret.append(IntImm(v))
        elif isinstance(v, IntVar):
            ret.append(v)
        elif isinstance(v, IntVarTensor):
            ret.append(v._attrs["int_var"])
    return ret
Helper function to convert a list of mixed int/IntVar/IntImm
into a list with only IntVar/IntImm.
python/aitemplate/utils/shape_utils.py