code: def test_all_ops(self, device, height, width, dt, a, t, s, sh, f, fn):
      # 4) Test rotation + translation + scale + shear
      tensor, pil_img = _create_data(height, width, device=device)
  
      if dt == torch.float16 and device == "cpu":
          # skip float16 on CPU case
          return
  
      if dt is not None:
          tensor = tensor.to(dtype=dt)
  
      f_pil = int(f[0]) if f is not None and len(f) == 1 else f
      out_pil_img = F.affine(
          pil_img,
          angle=a,
          translate=t,
          scale=s,
          shear=sh,
          interpolation=NEAREST,
          fill=f_pil,
      )
      out_pil_tensor = torch.from_numpy(
          np.array(out_pil_img).transpose((2, 0, 1))
      )
  
      out_tensor = fn(
          tensor,
          angle=a,
          translate=t,
          scale=s,
          shear=sh,
          interpolation=NEAREST,
          fill=f,
      ).cpu()
  
      if out_tensor.dtype != torch.uint8:
          out_tensor = out_tensor.to(torch.uint8)
  
      num_diff_pixels = (
          out_tensor != out_pil_tensor
      ).sum().item() / 3.0
      ratio_diff_pixels = (
          num_diff_pixels / out_tensor.shape[-1] / out_tensor.shape[-2]
      )
      # Tolerance : less than 5% (cpu), 6% (cuda) of different pixels
      tol = 0.06 if device == "cuda" else 0.05
      assert ratio_diff_pixels < tol
  
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 5 for calling the TestAffine obj's underlying member method code with example usage: obj.test_all_ops(device, height, width, dt, a, t, s, sh, f, fn) without return types