def calc_kl_div(a,b):
    """
        Calculates the KL-divergence with ref tensor a, comparing to a new tensor b.
        source of formula: https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
    """
    return (a * (a / b).log()).sum()