import math


def get_bpd(log_p, dimentions=28*28):
    """
    bpd = (nll_val / num_pixels) / numpy.log(2).

    log_p: log probability
    dimentions: dimentions (resolution) of image
    """
    return ((-log_p / dimentions) / math.log(2)).mean().item()