(self, x, y)
| 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() |
nothing calls this directly
no test coverage detected