code: def test_low_sample_amount(sampling_strategy):
      """Test that the metric works with very little data.
  
      In this case it is very likely that no samples from a current batch should be included in one of the bootstraps,
      but this should still not crash the metric.
      See issue: https://github.com/Lightning-AI/torchmetrics/issues/2048
  
      """
      preds = torch.randn(3, 3).softmax(dim=-1)
      target = torch.LongTensor([0, 0, 0])
      bootstrap_f1 = BootStrapper(
          MulticlassF1Score(num_classes=3, average=None),
          num_bootstraps=20,
          sampling_strategy=sampling_strategy,
      )
      assert bootstrap_f1(preds, target)
  
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 4 for calling a global function with example usage: test_low_sample_amount(sampling_strategy) without return types