Spaces:
Runtime error
Runtime error
File size: 214 Bytes
b621857 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# -*- coding: utf-8 -*-
import torch
def compute_psnr(x, y, data_range: float = 2, eps: float = 1e-7):
mse = torch.mean((x - y) ** 2)
psnr = 10 * torch.log10(data_range / (mse + eps))
return psnr
|