MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / forward

Method forward

evaluation/lpips.py:75–85  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

73 own_state_dict[name].copy_(param)
74
75 def forward(self, x, y):
76 x = (x - self.mu.to(x.device)) / self.sigma.to(x.device)
77 y = (y - self.mu.to(x.device)) / self.sigma.to(x.device)
78 x_fmaps = self.alexnet(x)
79 y_fmaps = self.alexnet(y)
80 lpips_value = 0
81 for x_fmap, y_fmap, conv1x1 in zip(x_fmaps, y_fmaps, self.lpips_weights):
82 x_fmap = normalize(x_fmap)
83 y_fmap = normalize(y_fmap)
84 lpips_value += torch.mean(conv1x1((x_fmap - y_fmap)**2))
85 return lpips_value
86
87
88@torch.no_grad()

Callers

nothing calls this directly

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected