import torch


def attention_disentanglement(att1, att2):
    """
        Implementation of the equation 5 from author's paper
        ARGS:
            att1: attention map A1
            att2: attention map A2
        Returns:
            Float value representing the loss
    """
    numer = torch.min(att1,att2).sum()
    denomi = torch.add(att1,att2).sum()

    return 2 * (numer / denomi)