def l2_dissimilarity(a, b):
    """Compute dissimilarity between rows of  `a` and `b` as
    :math:`||a-b||_2^2`.

    """
    assert len(a.shape) == len(b.shape)
    return (a - b).norm(p=2, dim=-1) ** 2
