(self,
                     midi_in=None,
                     pianorolls_in=None,
                     gen_batch_size=3,
                     piece_length=16,
                     new_strategy=None)
return midi_outs
Generates, conditions on midi_in if given, returns midi.

    Args:
      midi_in: An optional PrettyMIDI instance containing notes to be
          conditioned on.
      pianorolls_in: An optional numpy.ndarray encoding the notes to be
          conditioned on as pianorolls.
      gen_batch_size: An integer specifying the number of outputs to generate.
      piece_length: An integer specifying the desired number of time steps to
          generate for the output, where a time step corresponds to the
          shortest duration supported by the model.
      new_strategy: new_strategy: A string specifying the key of the strategy
          to use. If not set, the most recently set strategy is used. If a
          strategy was never specified, then the default strategy that was
          instantiated during initialization is used.

    Returns:
      A list of PrettyMIDI instances, with length gen_batch_size.
Generates, conditions on midi_in if given, returns midi.
Generates conditions on midi_in if given returns midi .
def run_generation(self,
                     midi_in=None,
                     pianorolls_in=None,
                     gen_batch_size=3,
                     piece_length=16,
                     new_strategy=None):
    """Generates, conditions on midi_in if given, returns midi.

    Args:
      midi_in: An optional PrettyMIDI instance containing notes to be
          conditioned on.
      pianorolls_in: An optional numpy.ndarray encoding the notes to be
          conditioned on as pianorolls.
      gen_batch_size: An integer specifying the number of outputs to generate.
      piece_length: An integer specifying the desired number of time steps to
          generate for the output, where a time step corresponds to the
          shortest duration supported by the model.
      new_strategy: new_strategy: A string specifying the key of the strategy
          to use. If not set, the most recently set strategy is used. If a
          strategy was never specified, then the default strategy that was
          instantiated during initialization is used.

    Returns:
      A list of PrettyMIDI instances, with length gen_batch_size.
    """
    if new_strategy is not None:
      self.strategy_name = new_strategy
      self.strategy = BaseStrategy.make(self.strategy_name, self.wmodel,
                                        self.logger, self.decoder)
    # Update the length of piece to be generated.
    self.hparams.crop_piece_len = piece_length
    shape = [gen_batch_size] + self.hparams.pianoroll_shape
    tf.logging.info("Tentative shape of pianorolls to be generated: %r", shape)

    # Generates.
    start_time = time.time()

    if midi_in is not None and "midi" in self.strategy_name.lower():
      pianorolls = self.strategy((shape, midi_in))
    elif "complete_manual" == self.strategy_name.lower():
      pianorolls = self.strategy(pianorolls_in)
    else:
      pianorolls = self.strategy(shape)
    self._pianorolls = pianorolls
    self._time_taken = (time.time() - start_time) / 60.0

    # Logs final step
    self.logger.log(pianorolls=pianorolls)

    midi_outs = get_midi_from_pianorolls(pianorolls, self.decoder)
    return midi_outs
def run_generation ( self , midi_in = None , pianorolls_in = None , gen_batch_size = 3 , piece_length = 16 , new_strategy = None ) : if new_strategy is not None : self . strategy_name = new_strategy self . strategy = BaseStrategy . make ( self . strategy_name , self . wmodel , self . logger , self . decoder ) # Update the length of piece to be generated. self . hparams . crop_piece_len = piece_length shape = [ gen_batch_size ] + self . hparams . pianoroll_shape tf . logging . info ( "Tentative shape of pianorolls to be generated: %r" , shape ) # Generates. start_time = time . time ( ) if midi_in is not None and "midi" in self . strategy_name . lower ( ) : pianorolls = self . strategy ( ( shape , midi_in ) ) elif "complete_manual" == self . strategy_name . lower ( ) : pianorolls = self . strategy ( pianorolls_in ) else : pianorolls = self . strategy ( shape ) self . _pianorolls = pianorolls self . _time_taken = ( time . time ( ) - start_time ) / 60.0 # Logs final step self . logger . log ( pianorolls = pianorolls ) midi_outs = get_midi_from_pianorolls ( pianorolls , self . decoder ) return midi_outs