code: def testEncodeDecode(self):
      start = PolyphonicEvent(event_type=PolyphonicEvent.START, pitch=0)
      step_end = PolyphonicEvent(
          event_type=PolyphonicEvent.STEP_END, pitch=0
      )
      new_note = PolyphonicEvent(
          event_type=PolyphonicEvent.NEW_NOTE, pitch=0
      )
      continued_note = PolyphonicEvent(
          event_type=PolyphonicEvent.CONTINUED_NOTE, pitch=60
      )
      continued_max_note = PolyphonicEvent(
          event_type=PolyphonicEvent.CONTINUED_NOTE, pitch=127
      )
  
      index = self.enc.encode_event(start)
      self.assertEqual(0, index)
      event = self.enc.decode_event(index)
      self.assertEqual(start, event)
  
      index = self.enc.encode_event(step_end)
      self.assertEqual(2, index)
      event = self.enc.decode_event(index)
      self.assertEqual(step_end, event)
  
      index = self.enc.encode_event(new_note)
      self.assertEqual(3, index)
      event = self.enc.decode_event(index)
      self.assertEqual(new_note, event)
  
      index = self.enc.encode_event(continued_note)
      self.assertEqual(191, index)
      event = self.enc.decode_event(index)
      self.assertEqual(continued_note, event)
  
      index = self.enc.encode_event(continued_max_note)
      self.assertEqual(258, index)
      event = self.enc.decode_event(index)
      self.assertEqual(continued_max_note, event)
  
file_path: magenta/magenta/models/polyphony_rnn/polyphony_encoder_decoder_test.py
imports: from magenta.models.polyphony_rnn import polyphony_encoder_decoder
  from magenta.models.polyphony_rnn.polyphony_lib import PolyphonicEvent
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the PolyphonyOneHotEncodingTest obj's underlying member method code with example usage: obj.testEncodeDecode() without return types