MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / lpips

Function lpips

lpipsPyTorch/__init__.py:6–21  ·  view source on GitHub ↗

r"""Function that measures Learned Perceptual Image Patch Similarity (LPIPS). Arguments: x, y (torch.Tensor): the input tensors to compare. net_type (str): the network type to compare the features: 'alex' | 'squeeze' | 'vgg'. Default: 'alex'.

(x: torch.Tensor,
          y: torch.Tensor,
          net_type: str = 'alex',
          version: str = '0.1')

Source from the content-addressed store, hash-verified

4
5
6def lpips(x: torch.Tensor,
7 y: torch.Tensor,
8 net_type: str = 'alex',
9 version: str = '0.1'):
10 r"""Function that measures
11 Learned Perceptual Image Patch Similarity (LPIPS).
12
13 Arguments:
14 x, y (torch.Tensor): the input tensors to compare.
15 net_type (str): the network type to compare the features:
16 'alex' | 'squeeze' | 'vgg'. Default: 'alex'.
17 version (str): the version of LPIPS. Default: 0.1.
18 """
19 device = x.device
20 criterion = LPIPS(net_type, version).to(device)
21 return criterion(x, y)

Callers 1

evaluateFunction · 0.90

Calls 1

LPIPSClass · 0.85

Tested by

no test coverage detected