code: def input_tensors_to_example(inputs, hparams):
      """Convert InputTensors to Example proto ready for serialization."""
      del hparams
  
      feature = {
          "spec": tf.train.Feature(
              float_list=tf.train.FloatList(value=inputs.spec.flatten())
          ),
          "spectrogram_hash": tf.train.Feature(
              int64_list=tf.train.Int64List(
                  value=[inputs.spectrogram_hash]
              )
          ),
          "labels": tf.train.Feature(
              float_list=tf.train.FloatList(
                  value=inputs.labels.flatten()
              )
          ),
          "label_weights": tf.train.Feature(
              float_list=tf.train.FloatList(
                  value=inputs.label_weights.flatten()
              )
          ),
          "length": tf.train.Feature(
              int64_list=tf.train.Int64List(value=[inputs.length])
          ),
          "onsets": tf.train.Feature(
              float_list=tf.train.FloatList(
                  value=inputs.onsets.flatten()
              )
          ),
          "offsets": tf.train.Feature(
              float_list=tf.train.FloatList(
                  value=inputs.offsets.flatten()
              )
          ),
          "velocities": tf.train.Feature(
              float_list=tf.train.FloatList(
                  value=inputs.velocities.flatten()
              )
          ),
          "sequence_id": tf.train.Feature(
              bytes_list=tf.train.BytesList(value=[inputs.sequence_id])
          ),
          "note_sequence": tf.train.Feature(
              bytes_list=tf.train.BytesList(
                  value=[inputs.note_sequence]
              )
          ),
      }
  
      return tf.train.Example(
          features=tf.train.Features(feature=feature)
      )
  
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 20 for calling a global function with example usage: input_tensors_to_example(inputs, hparams) and returns: tf