code: def plot_tts_output(
      data_2d,
      title_2d,
      data_1d,
      title_1d,
      figsize=(24, 4),
      v_min=DEFAULT_V_MIN,
      v_max=3,
      ret_np=False,
      suptitle="",
  ):
      try:
          import matplotlib.pyplot as plt
          from mpl_toolkits.axes_grid1 import make_axes_locatable
      except ImportError:
          raise ImportError(
              "Please install Matplotlib: pip install matplotlib"
          )
  
      data_2d = [
          x.detach().cpu().float().numpy()
          if isinstance(x, torch.Tensor)
          else x
          for x in data_2d
      ]
      fig, axes = plt.subplots(1, len(data_2d) + 1, figsize=figsize)
      if suptitle:
          fig.suptitle(suptitle[:400])  # capped at 400 chars
      axes = [axes] if len(data_2d) == 0 else axes
      for ax, x, name in zip(axes, data_2d, title_2d):
          ax.set_title(name)
          divider = make_axes_locatable(ax)
          cax = divider.append_axes("right", size="5%", pad=0.05)
          im = ax.imshow(
              x,
              origin="lower",
              aspect="auto",
              vmin=max(x.min(), v_min),
              vmax=min(x.max(), v_max),
          )
          fig.colorbar(im, cax=cax, orientation="vertical")
  
      if isinstance(data_1d, torch.Tensor):
          data_1d = data_1d.detach().cpu().numpy()
      axes[-1].plot(data_1d)
      axes[-1].set_title(title_1d)
      plt.tight_layout()
  
      if ret_np:
          fig.canvas.draw()
          data = save_figure_to_numpy(fig)
          plt.close(fig)
          return data
  
imports: import logging
  import os
  import os.path
  import torch
  import torch.nn.functional
  import numpy
  from fairseq.data.audio.text_to_speech_dataset import TextToSpeechDatasetCreator
  from fairseq.tasks import register_task
  from fairseq.tasks.speech_to_text import SpeechToTextTask
  from fairseq.speech_generator import AutoRegressiveSpeechGenerator, NonAutoregressiveSpeechGenerator, TeacherForcingAutoRegressiveSpeechGenerator
label_desc: Use image node_id 2 for calling a global function with example usage: plot_tts_output(data_2d, title_2d, data_1d, title_1d, figsize, v_min, v_max, ret_np, suptitle) and returns: data