def decode()

in transformer-xl/utils/performance_event_repo.py [0:0]


    def decode(self, event_ids, save_path=None):
        """
        Transform a sequence of event indices into a performance MIDI file.
        Args:
          event_ids: List of performance event indices.
        Returns:
          Path to the temporary file where the MIDI was saved.
        """
        performance = note_seq.performance_lib.Performance(
            quantized_sequence=None,
            steps_per_second=self._steps_per_second,
            num_velocity_bins=self._num_velocity_bins)

        tokens = []
        for i, event_id in enumerate(event_ids):
            if len(tokens) >= 2 and self.ids_to_events[tokens[-1]] == 'TIME_SHIFT_100' and self.ids_to_events[
                tokens[-1]] == 'TIME_SHIFT_100' and \
                    self.ids_to_events[event_id] == 'TIME_SHIFT_100':
                continue
            tokens.append(event_id)
            
            if event_id>1:
                performance.append(self.decode_event(event_id))
            
        ns = performance.to_sequence(max_note_duration=3)
        note_seq.sequence_proto_to_midi_file(ns, save_path)

        return save_path