import torch


def calc_psnr(img1, img2):
    """ PSNR calculator

    :param img1: true/estimated image
    :param img2: estimated/true image
    :return: PSNR value

    """

    return 10. * torch.log10(1. / torch.mean((img1 - img2) ** 2))