code: def plot_ir(magnitudes, ir, num_fft=2048):
      fr = torch.fft.rfft(ir, n=num_fft, dim=0).abs()
      ir_size = ir.size(-1)
      half = ir_size // 2
  
      fig, axes = plt.subplots(3, 1)
      t = torch.linspace(-half, half - 1, ir_size)
      axes[0].plot(t, ir)
      axes[0].grid(True)
      axes[0].set(title="Impulse Response")
      axes[0].set_xticks([i * half // 4 for i in range(-4, 5)])
      t = torch.linspace(0, 1, fr.numel())
      axes[1].plot(t, fr, label="Actual")
      axes[2].semilogy(t, fr, label="Actual")
      t = torch.linspace(0, 1, magnitudes.numel())
      for i in range(1, 3):
          axes[i].plot(
              t,
              magnitudes,
              label="Desired (input)",
              linewidth=1.1,
              linestyle="--",
          )
          axes[i].grid(True)
      axes[1].set(title="Frequency Response")
      axes[2].set(
          title="Frequency Response (log-scale)", xlabel="Frequency"
      )
      axes[2].legend(loc="center right")
      fig.tight_layout()
  
imports: import torch
  import torchaudio
  import matplotlib.pyplot
  from torchaudio.prototype.functional import frequency_impulse_response, sinc_impulse_response
label_desc: Use image node_id 3 for calling a global function with example usage: plot_ir(magnitudes, ir, num_fft) without return types