code: def test_resize_antialias(device, dt, size, interpolation):
      if dt == torch.float16 and device == "cpu":
          # skip float16 on CPU case
          return
  
      torch.manual_seed(12)
      script_fn = torch.jit.script(F.resize)
      tensor, pil_img = _create_data(320, 290, device=device)
  
      if dt is not None:
          # This is a trivial cast to float of uint8 data to test all cases
          tensor = tensor.to(dt)
  
      resized_tensor = F.resize(
          tensor, size=size, interpolation=interpolation, antialias=True
      )
      resized_pil_img = F.resize(
          pil_img,
          size=size,
          interpolation=interpolation,
          antialias=True,
      )
  
      assert resized_tensor.size()[1:] == resized_pil_img.size[::-1]
  
      resized_tensor_f = resized_tensor
      # we need to cast to uint8 to compare with PIL image
      if resized_tensor_f.dtype == torch.uint8:
          resized_tensor_f = resized_tensor_f.to(torch.float)
  
      _assert_approx_equal_tensor_to_pil(
          resized_tensor_f,
          resized_pil_img,
          tol=0.5,
          msg=f"{size}, {interpolation}, {dt}",
      )
  
      accepted_tol = 1.0 + 1e-5
      if interpolation == BICUBIC:
          # this overall mean value to make the tests pass
          # High value is mostly required for test cases with
          # downsampling and upsampling where we can not exactly
          # match PIL implementation.
          accepted_tol = 15.0
  
      _assert_approx_equal_tensor_to_pil(
          resized_tensor_f,
          resized_pil_img,
          tol=accepted_tol,
          agg_method="max",
          msg=f"{size}, {interpolation}, {dt}",
      )
  
      if isinstance(size, int):
          script_size = [
              size,
          ]
      else:
          script_size = size
  
      resize_result = script_fn(
          tensor,
          size=script_size,
          interpolation=interpolation,
          antialias=True,
      )
      assert_equal(resized_tensor, resize_result)
  
imports: import colorsys
  import itertools
  import math
  import os
  from functools import partial
  from typing import Sequence
  import numpy
  import PIL.Image
  import pytest
  import torch
  import torchvision.transforms
  import torchvision.transforms._functional_pil
  import torchvision.transforms._functional_tensor
  import torchvision.transforms.functional
  from common_utils import _assert_approx_equal_tensor_to_pil, _assert_equal_tensor_to_pil, _create_data, _create_data_batch, _test_fn_on_batch, assert_equal, cpu_and_cuda, needs_cuda
  from torchvision.transforms import InterpolationMode
label_desc: Use image node_id 9 for calling a global function with example usage: test_resize_antialias(device, dt, size, interpolation) without return types