def calculate_psnr(img1, img2):
    '\n    data range [0, 1]\n    '
    img1 = img1.clamp(0, 1)
    img2 = img2.clamp(0, 1)
    mse = torch.mean(((img1 - img2) ** 2), [1, 2, 3])
    PIXEL_MAX = 1
    return (20 * torch.mean(torch.log10((PIXEL_MAX / torch.sqrt(mse)))))
data range [0, 1]
def calculate_psnr(img1, img2):
    '\n    \n    '
    img1 = img1.clamp(0, 1)
    img2 = img2.clamp(0, 1)
    mse = torch.mean(((img1 - img2) ** 2), [1, 2, 3])
    PIXEL_MAX = 1
    return (20 * torch.mean(torch.log10((PIXEL_MAX / torch.sqrt(mse)))))