code: def test_decode_jpeg_cuda(mode, img_path, scripted):
      if "cmyk" in img_path:
          pytest.xfail("Decoding a CMYK jpeg isn't supported")
  
      data = read_file(img_path)
      img = decode_image(data, mode=mode)
      f = torch.jit.script(decode_jpeg) if scripted else decode_jpeg
      img_nvjpeg = f(data, mode=mode, device="cuda")
  
      # Some difference expected between jpeg implementations
      assert (img.float() - img_nvjpeg.cpu().float()).abs().mean() < 2
  
imports: import glob
  import io
  import os
  import sys
  from pathlib import Path
  import numpy
  import pytest
  import torch
  import torchvision.transforms.functional
  from common_utils import assert_equal, needs_cuda
  from PIL import __version__, Image
  from torchvision.io.image import _read_png_16, decode_image, decode_jpeg, decode_png, encode_jpeg, encode_png, ImageReadMode, read_file, read_image, write_file, write_jpeg, write_png
label_desc: Use image node_id 21 for calling a global function with example usage: test_decode_jpeg_cuda(mode, img_path, scripted) without return types