def bdet2(M):
    """Computes the determinant of batched 2x2 matrices

    Args:
        M (torch.tensor): input matrices

    Returns:
        torch.tensor: determinants of the matrices
    """

    return M[..., 0, 0] * M[..., 1, 1] - M[..., 0, 1] * M[..., 1, 0]