code: def benchmark(sample_rate, resample_rate):
      times, rows = [], []
      waveform = get_sine_sweep(sample_rate).to(torch.float32)
  
      args = (waveform, sample_rate, resample_rate)
  
      # sinc 64 zero-crossings
      f_time = benchmark_resample_functional(
          *args, lowpass_filter_width=64
      )
      t_time = benchmark_resample_transforms(
          *args, lowpass_filter_width=64
      )
      times.append([None, f_time, t_time])
      rows.append("sinc (width 64)")
  
      # sinc 6 zero-crossings
      f_time = benchmark_resample_functional(
          *args, lowpass_filter_width=16
      )
      t_time = benchmark_resample_transforms(
          *args, lowpass_filter_width=16
      )
      times.append([None, f_time, t_time])
      rows.append("sinc (width 16)")
  
      # kaiser best
      kwargs = {
          "lowpass_filter_width": 64,
          "rolloff": 0.9475937167399596,
          "resampling_method": "sinc_interp_kaiser",
          "beta": 14.769656459379492,
      }
      lib_time = benchmark_resample_librosa(
          *args, res_type="kaiser_best"
      )
      f_time = benchmark_resample_functional(*args, **kwargs)
      t_time = benchmark_resample_transforms(*args, **kwargs)
      times.append([lib_time, f_time, t_time])
      rows.append("kaiser_best")
  
      # kaiser fast
      kwargs = {
          "lowpass_filter_width": 16,
          "rolloff": 0.85,
          "resampling_method": "sinc_interp_kaiser",
          "beta": 8.555504641634386,
      }
      lib_time = benchmark_resample_librosa(
          *args, res_type="kaiser_fast"
      )
      f_time = benchmark_resample_functional(*args, **kwargs)
      t_time = benchmark_resample_transforms(*args, **kwargs)
      times.append([lib_time, f_time, t_time])
      rows.append("kaiser_fast")
  
      df = pd.DataFrame(
          times,
          columns=["librosa", "functional", "transforms"],
          index=rows,
      )
      return df
  
imports: import torch
  import torchaudio
  import torchaudio.functional
  import torchaudio.transforms
  import math
  import timeit
  import librosa
  import matplotlib.colors
  import matplotlib.pyplot
  import pandas
  import resampy
  from IPython.display import Audio
label_desc: Use image node_id 9 for calling a global function with example usage: benchmark(sample_rate, resample_rate) and returns: df