code: def preprocess_example(example_proto, hparams, is_training):
      """Compute spectral representation, labels, and length from sequence/audio.
  
      Args:
        example_proto: Example that has not been preprocessed.
        hparams: HParams object specifying hyperparameters.
        is_training: Whether or not this is a training run.
  
      Returns:
        An InputTensors tuple.
  
      Raises:
        ValueError: If hparams is contains an invalid spec_type.
      """
      record = parse_example(example_proto)
      sequence_id = record["id"]
      sequence = record["sequence"]
      audio = record["audio"]
      velocity_range = record["velocity_range"]
  
      wav_jitter_amount_ms = label_jitter_amount_ms = 0
      # if there is combined jitter, we must generate it once here
      if is_training and hparams.jitter_amount_ms > 0:
          wav_jitter_amount_ms = np.random.choice(
              hparams.jitter_amount_ms, size=1
          )
          label_jitter_amount_ms = wav_jitter_amount_ms
  
      if label_jitter_amount_ms > 0:
          sequence = jitter_label_op(
              sequence, label_jitter_amount_ms / 1000.0
          )
  
      # possibly shift the entire sequence backward for better forward only training
      if hparams.backward_shift_amount_ms > 0:
          sequence = jitter_label_op(
              sequence, hparams.backward_shift_amount_ms / 1000.0
          )
  
      if is_training:
          audio = transform_wav_data_op(
              audio,
              hparams=hparams,
              jitter_amount_sec=wav_jitter_amount_ms / 1000.0,
          )
  
      spec = wav_to_spec_op(audio, hparams=hparams)
      spectrogram_hash = get_spectrogram_hash_op(spec)
  
      (
          labels,
          label_weights,
          onsets,
          offsets,
          velocities,
      ) = sequence_to_pianoroll_op(
          sequence, velocity_range, hparams=hparams
      )
  
      length = wav_to_num_frames_op(
          audio, hparams_frames_per_second(hparams)
      )
  
      asserts = []
      if hparams.max_expected_train_example_len and is_training:
          asserts.append(
              tf.assert_less_equal(
                  length, hparams.max_expected_train_example_len
              )
          )
  
      with tf.control_dependencies(asserts):
          return InputTensors(
              spec=spec,
              spectrogram_hash=spectrogram_hash,
              labels=labels,
              label_weights=label_weights,
              length=length,
              onsets=onsets,
              offsets=offsets,
              velocities=velocities,
              sequence_id=sequence_id,
              note_sequence=sequence,
          )
  
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 19 for calling a global function with example usage: preprocess_example(example_proto, hparams, is_training) and returns: InputTensors