def get_static_stride(shape, dim) -> Optional[int]:
    """
    This is a helper function that returns the static stride for dim.
    It returns None if it cannot generate a static stride.
    """
    from aitemplate.compiler.base import IntImm

    stride = 1
    for d in shape[dim + 1 :]:
        if not isinstance(d, IntImm):
            return None
        stride *= d.value()
    return stride

    This is a helper function that returns the static stride for dim.
    It returns None if it cannot generate a static stride.
    
python/aitemplate/utils/shape_utils.py