code: def test_compare_fid(tmpdir, equal_size, feature=768):
      """Check that the hole pipeline give the same result as torch-fidelity."""
      from torch_fidelity import calculate_metrics
  
      metric = FrechetInceptionDistance(feature=feature).cuda()
  
      n, m = 100, 100 if equal_size else 90
  
      # Generate some synthetic data
      torch.manual_seed(42)
      img1 = torch.randint(0, 180, (n, 3, 299, 299), dtype=torch.uint8)
      img2 = torch.randint(
          100, 255, (m, 3, 299, 299), dtype=torch.uint8
      )
  
      batch_size = 10
      for i in range(n // batch_size):
          metric.update(
              img1[batch_size * i : batch_size * (i + 1)].cuda(),
              real=True,
          )
  
      for i in range(m // batch_size):
          metric.update(
              img2[batch_size * i : batch_size * (i + 1)].cuda(),
              real=False,
          )
  
      torch_fid = calculate_metrics(
          input1=_ImgDataset(img1),
          input2=_ImgDataset(img2),
          fid=True,
          feature_layer_fid=str(feature),
          batch_size=batch_size,
          save_cpu_ram=True,
      )
  
      tm_res = metric.compute()
  
      assert torch.allclose(
          tm_res.cpu(),
          torch.tensor([torch_fid["frechet_inception_distance"]]),
          atol=1e-3,
      )
  
imports: import pickle
  from contextlib import nullcontext
  from functools import partial
  import pytest
  import torch
  from torch.nn import Module
  from torch.utils.data import Dataset
  from torchmetrics.image.fid import FrechetInceptionDistance, NoTrainInceptionV3
  from torchmetrics.utilities.imports import _TORCH_FIDELITY_AVAILABLE
label_desc: Use image node_id 6 for calling a global function with example usage: test_compare_fid(tmpdir, equal_size, feature) without return types