code: def f0_summary(
      f0_hz, f0_hz_predict, step, name="f0_midi", tag="f0_midi"
  ):
      """Creates a plot comparison of ground truth f0_hz and predicted values."""
      batch_size = int(f0_hz.shape[0])
  
      # Resample predictions to match ground truth if they don't already.
      if f0_hz.shape[1] != f0_hz_predict.shape[1]:
          f0_hz_predict = ddsp.core.resample(
              f0_hz_predict, f0_hz.shape[1]
          )
  
      for i in range(batch_size):
          f0_midi = ddsp.core.hz_to_midi(tf.squeeze(f0_hz[i]))
          f0_midi_predict = ddsp.core.hz_to_midi(
              tf.squeeze(f0_hz_predict[i])
          )
  
          # Manually specify exact size of fig for tensorboard
          fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(6.0, 2.0))
          ax0.plot(f0_midi)
          ax0.plot(f0_midi_predict)
          ax0.set_title("original vs. predicted")
  
          ax1.plot(f0_midi_predict)
          ax1.set_title("predicted")
  
          # Format and save plot to image
          tag = f"{tag}/{name}_{i + 1}"
          fig_summary(tag, 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 7 for calling a global function with example usage: f0_summary(f0_hz, f0_hz_predict, step, name, tag) without return types