code: def _test_fn_on_batch(
      batch_tensors, fn, scripted_fn_atol=1e-8, **fn_kwargs
  ):
      transformed_batch = fn(batch_tensors, **fn_kwargs)
      for i in range(len(batch_tensors)):
          img_tensor = batch_tensors[i, ...]
          transformed_img = fn(img_tensor, **fn_kwargs)
          torch.testing.assert_close(
              transformed_img,
              transformed_batch[i, ...],
              rtol=0,
              atol=1e-6,
          )
  
      if scripted_fn_atol >= 0:
          scripted_fn = torch.jit.script(fn)
          # scriptable function test
          s_transformed_batch = scripted_fn(batch_tensors, **fn_kwargs)
          torch.testing.assert_close(
              transformed_batch,
              s_transformed_batch,
              rtol=1e-5,
              atol=scripted_fn_atol,
          )
  
imports: import contextlib
  import functools
  import itertools
  import os
  import pathlib
  import random
  import re
  import shutil
  import sys
  import tempfile
  import warnings
  from subprocess import CalledProcessError, check_output, STDOUT
  import numpy
  import PIL.Image
  import pytest
  import torch
  import torch.testing
  from PIL import Image
  from torch.testing._comparison import BooleanPair, NonePair, not_close_error_metas, NumberPair, TensorLikePair
  from torchvision import io, tv_tensors
  from torchvision.transforms._functional_tensor import _max_value
  from torchvision.transforms.v2.functional import to_image, to_pil_image
label_desc: Use image node_id 19 for calling a global function with example usage: _test_fn_on_batch(batch_tensors, fn, scripted_fn_atol) without return types