code: def sequence_to_pianoroll_op(
      sequence_tensor, velocity_range_tensor, hparams
  ):
      """Transforms a serialized NoteSequence to a pianoroll."""
  
      def sequence_to_pianoroll_fn(
          sequence_tensor, velocity_range_tensor
      ):
          """Converts sequence to pianorolls."""
          velocity_range = music_pb2.VelocityRange.FromString(
              velocity_range_tensor
          )
          sequence = music_pb2.NoteSequence.FromString(sequence_tensor)
          sequence = sequences_lib.apply_sustain_control_changes(
              sequence
          )
          roll = sequences_lib.sequence_to_pianoroll(
              sequence,
              frames_per_second=hparams_frames_per_second(hparams),
              min_pitch=constants.MIN_MIDI_PITCH,
              max_pitch=constants.MAX_MIDI_PITCH,
              min_frame_occupancy_for_label=hparams.min_frame_occupancy_for_label,
              onset_mode=hparams.onset_mode,
              onset_length_ms=hparams.onset_length,
              offset_length_ms=hparams.offset_length,
              onset_delay_ms=hparams.onset_delay,
              min_velocity=velocity_range.min,
              max_velocity=velocity_range.max,
          )
          return (
              roll.active,
              roll.weights,
              roll.onsets,
              roll.onset_velocities,
              roll.offsets,
          )
  
      res, weighted_res, onsets, velocities, offsets = tf.py_func(
          sequence_to_pianoroll_fn,
          [sequence_tensor, velocity_range_tensor],
          [tf.float32, tf.float32, tf.float32, tf.float32, tf.float32],
          name="sequence_to_pianoroll_op",
      )
      res.set_shape([None, constants.MIDI_PITCHES])
      weighted_res.set_shape([None, constants.MIDI_PITCHES])
      onsets.set_shape([None, constants.MIDI_PITCHES])
      offsets.set_shape([None, constants.MIDI_PITCHES])
      velocities.set_shape([None, constants.MIDI_PITCHES])
  
      return res, weighted_res, onsets, offsets, velocities
  
imports: import collections
  import functools
  import io
  import re
  import wave
  import zlib
  import librosa
  from magenta.models.onsets_frames_transcription import audio_transform
  from magenta.models.onsets_frames_transcription import constants
  from magenta.models.onsets_frames_transcription import drum_mappings
  from magenta.models.onsets_frames_transcription import melspec_input
  from note_seq import audio_io
  from note_seq import sequences_lib
  from note_seq.protobuf import music_pb2
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 14 for calling a global function with example usage: sequence_to_pianoroll_op(sequence_tensor, velocity_range_tensor, hparams) and returns: res,  weighted_res,  onsets,  offsets,  velocities, roll,  roll,  roll,  roll,  roll