code: def run_tests(height, width, duration=4):
      # Generate the test data
      print(f"Testing resolution: {width}x{height}")
      pict_config = {
          "height": height,
          "width": width,
          "frame_rate": 30000 / 1001,
          "format": "yuv444p",
      }
  
      data = get_data(**pict_config, duration=duration)
      data = data.to(torch.device("cuda:0"))
  
      times = []
      sizes = []
  
      # Test software encoding
      encoder_config = {
          "encoder": "libx264",
          "encoder_format": "yuv444p",
      }
      for i, num_threads in enumerate([1, 4, 8]):
          print(f"* Software Encoder (num_threads={num_threads})")
          time_, size = test_encode(
              data,
              encoder_option={"threads": str(num_threads)},
              **pict_config,
              **encoder_config,
          )
          times.append(time_)
          if i == 0:
              sizes.append(size)
  
      # Test hardware encoding
      encoder_config = {
          "encoder": "h264_nvenc",
          "encoder_format": "yuv444p",
          "encoder_option": {"gpu": "0"},
      }
      for i, hw_accel in enumerate([None, "cuda"]):
          print(
              f"* Hardware Encoder {'(CUDA frames)' if hw_accel else ''}"
          )
          time_, size = test_encode(
              data,
              **pict_config,
              **encoder_config,
              hw_accel=hw_accel,
          )
          times.append(time_)
          if i == 0:
              sizes.append(size)
      return times, sizes
  
file_path: audio/examples/tutorials/nvenc_tutorial.py
imports: import torch
  import torchaudio
  import io
  import time
  import matplotlib.pyplot
  from IPython.display import Video
  from torchaudio.io import StreamReader, StreamWriter
  from torchaudio.utils import ffmpeg_utils
label_desc: Use image node_id 3 for calling a global function with example usage: run_tests(height, width, duration) and returns: times,  sizes