MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / forward

Method forward

lpipsPyTorch/modules/lpips.py:30–36  ·  view source on GitHub ↗
(self, x: torch.Tensor, y: torch.Tensor)

Source from the content-addressed store, hash-verified

28 self.lin.load_state_dict(get_state_dict(net_type, version))
29
30 def forward(self, x: torch.Tensor, y: torch.Tensor):
31 feat_x, feat_y = self.net(x), self.net(y)
32
33 diff = [(fx - fy) ** 2 for fx, fy in zip(feat_x, feat_y)]
34 res = [l(d).mean((2, 3), True) for d, l in zip(diff, self.lin)]
35
36 return torch.sum(torch.cat(res, 0), 0, True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected