code: def test_x_crop(fn, method, out_length, size, device):
      meth_kwargs = fn_kwargs = {"size": size}
      scripted_fn = torch.jit.script(fn)
  
      tensor, pil_img = _create_data(height=20, width=20, device=device)
      transformed_t_list = fn(tensor, **fn_kwargs)
      transformed_p_list = fn(pil_img, **fn_kwargs)
      assert len(transformed_t_list) == len(transformed_p_list)
      assert len(transformed_t_list) == out_length
      for transformed_tensor, transformed_pil_img in zip(
          transformed_t_list, transformed_p_list
      ):
          _assert_equal_tensor_to_pil(
              transformed_tensor, transformed_pil_img
          )
  
      transformed_t_list_script = scripted_fn(
          tensor.detach().clone(), **fn_kwargs
      )
      assert len(transformed_t_list) == len(transformed_t_list_script)
      assert len(transformed_t_list_script) == out_length
      for transformed_tensor, transformed_tensor_script in zip(
          transformed_t_list, transformed_t_list_script
      ):
          assert_equal(transformed_tensor, transformed_tensor_script)
  
      # test for class interface
      fn = method(**meth_kwargs)
      scripted_fn = torch.jit.script(fn)
      output = scripted_fn(tensor)
      assert len(output) == len(transformed_t_list_script)
  
      # test on batch of tensors
      batch_tensors = _create_data_batch(
          height=23, width=34, channels=3, num_samples=4, device=device
      )
      torch.manual_seed(12)
      transformed_batch_list = fn(batch_tensors)
  
      for i in range(len(batch_tensors)):
          img_tensor = batch_tensors[i, ...]
          torch.manual_seed(12)
          transformed_img_list = fn(img_tensor)
          for transformed_img, transformed_batch in zip(
              transformed_img_list, transformed_batch_list
          ):
              assert_equal(transformed_img, transformed_batch[i, ...])
  
imports: import os
  import sys
  import numpy
  import PIL.Image
  import pytest
  import torch
  from common_utils import _assert_approx_equal_tensor_to_pil, _assert_equal_tensor_to_pil, _create_data, _create_data_batch, assert_equal, cpu_and_cuda, float_dtypes, get_tmp_dir, int_dtypes
  from torchvision import transforms
  from torchvision.transforms import functional, InterpolationMode
  from torchvision.transforms.autoaugment import _apply_op
label_desc: Use image node_id 14 for calling a global function with example usage: test_x_crop(fn, method, out_length, size, device) without return types