code: def spectrogram_summary(
      audio, audio_gen, step, name="", tag="spectrogram"
  ):
      """Writes a summary of spectrograms for a batch of images."""
      specgram = lambda a: ddsp.spectral_ops.compute_logmag(
          tf_float32(a), size=768
      )
  
      # Batch spectrogram operations
      spectrograms = specgram(audio)
      spectrograms_gen = specgram(audio_gen)
  
      batch_size = int(audio.shape[0])
      name = name + "_" if name else ""
  
      for i in range(batch_size):
          # Manually specify exact size of fig for tensorboard
          fig, axs = plt.subplots(2, 1, figsize=(8, 8))
  
          _plt_spec(spectrograms[i], axs[0], "original")
          _plt_spec(spectrograms_gen[i], axs[1], "synthesized")
  
          # Format and save plot to image
          tag_i = f"{tag}/{name}{i+1}"
          fig_summary(tag_i, fig, step)
  
imports: import io
  import ddsp
  from ddsp.core import tf_float32
  from ddsp.training.plotting import pianoroll_plot_setup
  import matplotlib.patches
  import matplotlib.pyplot
  from matplotlib.ticker import MaxNLocator
  import note_seq
  from note_seq import sequences_lib
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 5 for calling a global function with example usage: spectrogram_summary(audio, audio_gen, step, name, tag) without return types