def _assert_strides_are_log2_contiguous(strides):
    """
    Assert that each stride is 2x times its preceding stride, i.e. "contiguous in log2".
    """
    for i, stride in enumerate(strides[1:], 1):
        assert stride == 2 * strides[
            i - 1], "Strides {} {} are not log2 contiguous".format(
                stride, strides[i - 1])

    Assert that each stride is 2x times its preceding stride, i.e. "contiguous in log2".
    
ptstructure/vqa/pytorchnlp/transformers/layoutxlm/visual_backbone.py