def METHOD_NAME(x):
    bdims = x.shape[:-2]
    M, D = x.shape[-2:]
    return (
        x.view(bdims + (M // 2, 2, D))
        .transpose(-1, -2)
        .contiguous()
        .view(bdims + (M, D))
    )