class_docstr: Metrics for MIDI Autoencoder.
class_docstr_tok: ["Metrics","for","MIDI","Autoencoder","."]
code: def sample(self, batch, outputs, step):
      audio = batch["audio"]
      summaries.audio_summary(
          audio, step, self._sample_rate, name="audio_original"
      )
  
      audio_keys = [
          "midi_audio",
          "synth_audio",
          "midi_audio2",
          "synth_audio2",
      ]
      for k in audio_keys:
          if k in outputs and outputs[k] is not None:
              summaries.audio_summary(
                  outputs[k], step, self._sample_rate, name=k
              )
              summaries.spectrogram_summary(
                  audio, outputs[k], step, tag=k
              )
              summaries.waveform_summary(
                  audio, outputs[k], step, name=k
              )
  
      summaries.f0_summary(
          batch[self._f0_key],
          outputs[f"{self._f0_key}_pred"],
          step,
          name="f0_hz_rec",
      )
  
      summaries.pianoroll_summary(
          outputs, step, "pianoroll", self._frame_rate, "pianoroll"
      )
      summaries.midiae_f0_summary(batch[self._f0_key], outputs, step)
      ld_rec = f"{self._db_key}_rec"
      if ld_rec in outputs:
          summaries.midiae_ld_summary(
              batch[self._db_key], outputs, step, self._db_key
          )
  
      summaries.midiae_sp_summary(outputs, step)
  
imports: import ddsp
  from ddsp.training import heuristics
  from ddsp.training import metrics
  from ddsp.training import summaries
  import gin
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling the MidiAutoencoderEvaluator obj's underlying member method code with example usage: obj.sample(batch, outputs, step) without return types