code: def testEncodeNoteSequence(self):
      encoder = music_encoders.MidiPerformanceEncoder(
          steps_per_second=100,
          num_velocity_bins=32,
          min_pitch=21,
          max_pitch=108,
      )
  
      ns = note_seq.NoteSequence()
      testing_lib.add_track_to_sequence(
          ns,
          0,
          [
              (60, 100, 0.0, 4.0),
              (64, 100, 0.0, 3.0),
              (67, 127, 1.0, 2.0),
          ],
      )
      ids = encoder.encode_note_sequence(ns)
  
      expected_ids = [
          302,  # VELOCITY(25)
          41,  # NOTE-ON(60)
          45,  # NOTE-ON(64)
          277,  # TIME-SHIFT(100)
          309,  # VELOCITY(32)
          48,  # NOTE-ON(67)
          277,  # TIME-SHIFT(100)
          136,  # NOTE-OFF(67)
          277,  # TIME-SHIFT(100)
          133,  # NOTE-OFF(64
          277,  # TIME-SHIFT(100)
          129,  # NOTE-OFF(60)
      ]
  
      self.assertEqual(expected_ids, ids)
  
imports: import tempfile
  from magenta.models.score2perf import music_encoders
  import note_seq
  from note_seq import testing_lib
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the MidiPerformanceEncoderTest obj's underlying member method code with example usage: obj.testEncodeNoteSequence() without return types