def is_singleton_dimension(dim) -> bool:
    """
    True if this dimension is 1. IntVars will return True if their
    upper and lower bounds are both 1.
    """
    from aitemplate.compiler.base import IntVarTensor

    if isinstance(dim, int):
        return dim == 1

    dim = dim._attrs["int_var"] if isinstance(dim, IntVarTensor) else dim
    return dim.upper_bound() == dim.lower_bound() and dim.upper_bound() == 1
True if this dimension is 1. IntVars will return True if their
upper and lower bounds are both 1.
python/aitemplate/utils/shape_utils.py