code: def _predict_sequences(
      frame_probs,
      onset_probs,
      frame_predictions,
      onset_predictions,
      offset_predictions,
      velocity_values,
      hparams,
  ):
      """Predict a batch of sequences."""
  
      def predict_sequence(
          frame_probs,
          onset_probs,
          frame_predictions,
          onset_predictions,
          offset_predictions,
          velocity_values,
          hparams,
      ):
          """Predict a single sequence."""
          if hparams.drums_only:
              sequence_prediction = infer_util.predict_sequence(
                  frame_probs=frame_probs,
                  onset_probs=onset_probs,
                  frame_predictions=onset_predictions,
                  onset_predictions=onset_predictions,
                  offset_predictions=onset_predictions,
                  velocity_values=velocity_values,
                  min_pitch=constants.MIN_MIDI_PITCH,
                  hparams=hparams,
                  onsets_only=True,
              )
              for note in sequence_prediction.notes:
                  note.is_drum = True
          else:
              sequence_prediction = infer_util.predict_sequence(
                  frame_probs=frame_probs,
                  onset_probs=onset_probs,
                  frame_predictions=frame_predictions,
                  onset_predictions=onset_predictions,
                  offset_predictions=offset_predictions,
                  velocity_values=velocity_values,
                  min_pitch=constants.MIN_MIDI_PITCH,
                  hparams=hparams,
              )
          return sequence_prediction.SerializeToString()
  
      sequences = []
      for i in range(frame_predictions.shape[0]):
          sequence = tf.py_func(
              functools.partial(predict_sequence, hparams=hparams),
              inp=[
                  frame_probs[i],
                  onset_probs[i],
                  frame_predictions[i],
                  onset_predictions[i],
                  offset_predictions[i],
                  velocity_values[i],
              ],
              Tout=tf.string,
              stateful=False,
          )
          sequence.set_shape([])
          sequences.append(sequence)
      return tf.stack(sequences)
  
file_path: magenta/magenta/models/onsets_frames_transcription/estimator_spec_util.py
imports: import functools
  from magenta.models.onsets_frames_transcription import constants
  from magenta.models.onsets_frames_transcription import drum_mappings
  from magenta.models.onsets_frames_transcription import infer_util
  from magenta.models.onsets_frames_transcription import metrics
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  import tf_slim
label_desc: Use image node_id 3 for calling a global function with example usage: _predict_sequences(frame_probs, onset_probs, frame_predictions, onset_predictions, offset_predictions, velocity_values, hparams) and returns: tf, sequence_prediction