class_docstr: A helper class to compute metrics for MIDI output.
class_docstr_tok: ["A","helper","class","to","compute","metrics","for","MIDI","output","."]
docstr: If the input is not a NoteSequence, convert it, else return it as is.
docstr_tok: ["If","the","input","is","not","a","NoteSequence",",","convert","it",",","else","return","it","as","is","."]
code: def _safe_convert_to_note_sequence(self, representation):
      """If the input is not a NoteSequence, convert it, else return it as is."""
      if isinstance(representation, note_seq.NoteSequence):
          return representation
      else:
          return sequences_lib.pianoroll_to_note_sequence(
              representation,
              frames_per_second=self._frames_per_second,
              min_duration_ms=0,
          )
  
imports: import dataclasses
  from absl import logging
  import ddsp
  import librosa
  import mir_eval
  import note_seq
  from note_seq import sequences_lib
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the MidiMetrics obj's underlying member method code with example usage: obj._safe_convert_to_note_sequence(representation) and returns: representation, sequences_lib