def l1_torus_dissimilarity(a, b):
    """See `paper by Ebisu et al. <https://www.semanticscholar.org/paper/TorusE%3A-Knowledge-Graph-Embedding-on-a-Lie-Group-Ebisu-Ichise/990334cf76845e2da64d3baa10b0a671e433d4b6>`_
    for details about the definition of this dissimilarity function.

    """
    assert len(a.shape) == len(b.shape)
    return 2 * min(abs(a - b), 1 - abs(a - b)).sum(dim=-1)
