code: def test_bootstrap_sampler(sampling_strategy):
      """Make sure that the bootstrap sampler works as intended."""
      old_samples = torch.randn(20, 2)
  
      # make sure that the new samples are only made up of old samples
      idx = _bootstrap_sampler(20, sampling_strategy=sampling_strategy)
      new_samples = old_samples[idx]
      for ns in new_samples:
          assert ns in old_samples
  
      found_one = _sample_checker(
          old_samples, new_samples, operator.eq, 2
      )
      assert (
          found_one
      ), "resampling did not work because no samples were sampled twice"
  
      found_zero = _sample_checker(
          old_samples, new_samples, operator.ne, 0
      )
      assert (
          found_zero
      ), "resampling did not work because all samples were at least sampled once"
  
file_path: torchmetrics/tests/unittests/wrappers/test_bootstrapping.py
imports: import operator
  from functools import partial
  from typing import Any
  import numpy
  import pytest
  import torch
  from lightning_utilities import apply_to_collection
  from sklearn.metrics import mean_squared_error, precision_score, recall_score
  from torch import Tensor
  from torchmetrics.classification import MulticlassF1Score, MulticlassPrecision, MulticlassRecall
  from torchmetrics.regression import MeanSquaredError
  from torchmetrics.wrappers.bootstrapping import BootStrapper, _bootstrap_sampler
  from unittests.helpers import seed_all
label_desc: Use image node_id 2 for calling a global function with example usage: test_bootstrap_sampler(sampling_strategy) without return types