code: def test_memory():
      """Test that the feature share wrapper uses less memory than the metric collection."""
      base_memory = torch.cuda.memory_allocated()
  
      fid = FrechetInceptionDistance().cuda()
      inception = InceptionScore().cuda()
      kid = KernelInceptionDistance().cuda()
  
      memory_before_fs = torch.cuda.memory_allocated()
      assert (
          memory_before_fs > base_memory
      ), "The memory usage should be higher after initializing the metrics."
  
      torch.cuda.empty_cache()
  
      FeatureShare([fid, inception, kid]).cuda()
      memory_after_fs = torch.cuda.memory_allocated()
  
      assert (
          memory_after_fs > base_memory
      ), "The memory usage should be higher after initializing the feature share wrapper."
      assert (
          memory_after_fs < memory_before_fs
      ), "The memory usage should be higher after initializing the feature share wrapper."
  
file_path: torchmetrics/tests/unittests/wrappers/test_feature_share.py
imports: import pytest
  import torch
  from torchmetrics import MetricCollection
  from torchmetrics.image import FrechetInceptionDistance, InceptionScore, KernelInceptionDistance, LearnedPerceptualImagePatchSimilarity, StructuralSimilarityIndexMeasure
  from torchmetrics.wrappers import FeatureShare
label_desc: Use image node_id 5 for calling a global function with example usage: test_memory() without return types