class_docstr: Stores a polyphonic sequence as a stream of single-note events.
  
  Events are PolyphonicEvent tuples that encode event type and pitch.
class_docstr_tok: ["Stores","a","polyphonic","sequence","as","a","stream","of","single-note","events",".","Events","are","PolyphonicEvent","tuples","that","encode","event","type","and","pitch","."]
docstr: Trims a given number of steps from the end of the sequence.
docstr_tok: ["Trims","a","given","number","of","steps","from","the","end","of","the","sequence","."]
code: def _trim_steps(self, num_steps):
      """Trims a given number of steps from the end of the sequence."""
      steps_trimmed = 0
      for i in reversed(range(len(self._events))):
          if self._events[i].event_type == PolyphonicEvent.STEP_END:
              if steps_trimmed == num_steps:
                  del self._events[i + 1 :]
                  break
              steps_trimmed += 1
          elif i == 0:
              self._events = [
                  PolyphonicEvent(
                      event_type=PolyphonicEvent.START, pitch=None
                  )
              ]
              break
  
imports: from __future__ import division
  import collections
  import copy
  from magenta.pipelines import statistics
  from note_seq import constants
  from note_seq import events_lib
  from note_seq import sequences_lib
  from note_seq.protobuf import music_pb2
  from six.moves import range
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling the PolyphonicSequence obj's underlying member method code with example usage: obj._trim_steps(num_steps) without return types