(frame_probs, onset_probs, frame_predictions,
                       onset_predictions, offset_predictions, velocity_values,
                       hparams)
return tf.stack(sequences)
Predict a batch of sequences.
Predict a batch of sequences.
Predict a batch of sequences .
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)
def _predict_sequences ( frame_probs , onset_probs , frame_predictions , onset_predictions , offset_predictions , velocity_values , hparams ) : 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 )