code: def _add_noise(x, scale=10):
      """Add noise to boxes and labels to make testing non-deterministic."""
      if isinstance(x, torch.Tensor):
          return x + scale * torch.rand_like(x)
      for batch in x:
          for sample in batch:
              sample["boxes"] = _add_noise(sample["boxes"], scale)
              sample["labels"] += abs(
                  torch.randint_like(sample["labels"], 0, 10)
              )
      return x
  
imports: from functools import partial
  import pytest
  import torch
  from torch import IntTensor, Tensor
  from torchmetrics.detection.ciou import CompleteIntersectionOverUnion
  from torchmetrics.detection.diou import DistanceIntersectionOverUnion
  from torchmetrics.detection.giou import GeneralizedIntersectionOverUnion
  from torchmetrics.detection.iou import IntersectionOverUnion
  from torchmetrics.functional.detection.ciou import complete_intersection_over_union
  from torchmetrics.functional.detection.diou import distance_intersection_over_union
  from torchmetrics.functional.detection.giou import generalized_intersection_over_union
  from torchmetrics.functional.detection.iou import intersection_over_union
  from torchmetrics.utilities.imports import _TORCHVISION_GREATER_EQUAL_0_13
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling a global function with example usage: _add_noise(x, scale) and returns: x, unknown