code: def test_sim_net():
      """Check that the similarity network is the same as the one used in torch_fidelity."""
      compare = SampleSimilarityLPIPS("sample_similarity", resize=64)
      simnet = _LPIPS(net="vgg", resize=64)
  
      # check that the weights are the same
      for name, weight in compare.named_parameters():
          getter = attrgetter(name)
          weight2 = getter(simnet)
          assert torch.allclose(weight, weight2)
  
      img1 = torch.rand(1, 3, 64, 64)
      img2 = torch.rand(1, 3, 64, 64)
  
      # note that by default the two networks expect different scaling of the images
      out = compare(255 * img1, 255 * img2)
      out2 = simnet(2 * img1 - 1, 2 * img2 - 1)
  
      assert torch.allclose(out, out2)
  
imports: from operator import attrgetter
  import pytest
  import torch
  import torch_fidelity
  from torch import nn
  from torch_fidelity.sample_similarity_lpips import SampleSimilarityLPIPS
  from torch_fidelity.utils import batch_interp
  from torchmetrics.functional.image.lpips import _LPIPS
  from torchmetrics.functional.image.perceptual_path_length import _interpolate, perceptual_path_length
  from torchmetrics.image.perceptual_path_length import PerceptualPathLength
  from torchmetrics.utilities.imports import _TORCH_FIDELITY_AVAILABLE
  from unittests import skip_on_running_out_of_memory
  from unittests.helpers import seed_all
label_desc: Use image node_id 2 for calling a global function with example usage: test_sim_net() without return types