From 67fb893a8a4f9975706f7d1bf49e44a305a38010 Mon Sep 17 00:00:00 2001 From: Federico Vaccaro <33399189+fede-vaccaro@users.noreply.github.com> Date: Sun, 13 Dec 2020 14:59:46 +0100 Subject: [PATCH] Update __init__.py --- lpips/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lpips/__init__.py b/lpips/__init__.py index 62b9a079..21d579d4 100755 --- a/lpips/__init__.py +++ b/lpips/__init__.py @@ -39,9 +39,9 @@ # return self.model.forward(target, pred) -def normalize_tensor(in_feat,eps=1e-10): - norm_factor = torch.sqrt(torch.sum(in_feat**2,dim=1,keepdim=True)) - return in_feat/(norm_factor+eps) +def normalize_tensor(in_feat,eps=1e-8): + norm_factor = torch.sqrt(eps + torch.sum(in_feat**2,dim=1,keepdim=True)) + return in_feat/norm_factor def l2(p0, p1, range=255.): return .5*np.mean((p0 / range - p1 / range)**2)