code: def test_compare_kid(tmpdir, feature=2048):
      """Check that the hole pipeline give the same result as torch-fidelity."""
      from torch_fidelity import calculate_metrics
  
      metric = KernelInceptionDistance(
          feature=feature, subsets=1, subset_size=100
      ).cuda()
  
      # Generate some synthetic data
      img1 = torch.randint(
          0, 180, (100, 3, 299, 299), dtype=torch.uint8
      )
      img2 = torch.randint(
          100, 255, (100, 3, 299, 299), dtype=torch.uint8
      )
  
      batch_size = 10
      for i in range(img1.shape[0] // batch_size):
          metric.update(
              img1[batch_size * i : batch_size * (i + 1)].cuda(),
              real=True,
          )
  
      for i in range(img2.shape[0] // 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),
          kid=True,
          feature_layer_fid=str(feature),
          batch_size=batch_size,
          kid_subsets=1,
          kid_subset_size=100,
          save_cpu_ram=True,
      )
  
      tm_mean, tm_std = metric.compute()
  
      assert torch.allclose(
          tm_mean.cpu(),
          torch.tensor([torch_fid["kernel_inception_distance_mean"]]),
          atol=1e-3,
      )
      assert torch.allclose(
          tm_std.cpu(),
          torch.tensor([torch_fid["kernel_inception_distance_std"]]),
          atol=1e-3,
      )
  
imports: import pickle
  from contextlib import nullcontext
  import pytest
  import torch
  from torch.nn import Module
  from torch.utils.data import Dataset
  from torchmetrics.image.kid import KernelInceptionDistance
  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_kid(tmpdir, feature) without return types