code: def test_kid_raises_errors_and_warnings():
      """Test that expected warnings and errors are raised."""
      with pytest.warns(
          UserWarning,
          match="Metric `Kernel Inception Distance` will save all extracted features in buffer."
          " For large datasets this may lead to large memory footprint.",
      ):
          KernelInceptionDistance()
  
      if _TORCH_FIDELITY_AVAILABLE:
          with pytest.raises(
              ValueError,
              match="Integer input to argument `feature` must be one of .*",
          ):
              KernelInceptionDistance(feature=2)
      else:
          with pytest.raises(
              ModuleNotFoundError,
              match="Kernel Inception Distance metric requires that `Torch-fidelity` is installed."
              " Either install as `pip install torchmetrics[image]` or `pip install torch-fidelity`.",
          ):
              KernelInceptionDistance()
  
      with pytest.raises(
          TypeError, match="Got unknown input to argument `feature`"
      ):
          KernelInceptionDistance(feature=[1, 2])
  
      m = KernelInceptionDistance()
      m.update(
          torch.randint(0, 255, (5, 3, 299, 299), dtype=torch.uint8),
          real=True,
      )
      m.update(
          torch.randint(0, 255, (5, 3, 299, 299), dtype=torch.uint8),
          real=False,
      )
      with pytest.raises(
          ValueError,
          match="Argument `subset_size` should be smaller than the number of samples",
      ):
          m.compute()
  
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 3 for calling a global function with example usage: test_kid_raises_errors_and_warnings() without return types