(self,
                     midi_in=None,
                     pianorolls_in=None,
                     masks=None,
                     gen_batch_size=3,
                     piece_length=16,
                     sample_steps=0,
                     current_step=0,
                     total_gibbs_steps=0,
                     temperature=0.99)
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.
      masks: a 4D numpy array of the same shape as pianorolls, with 1s
          indicating mask out.  If is None, then the masks will be where have 1s
          where there are no notes, indicating to the model they should be
          filled in.
      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.
      See the CoconetSampleGraph class in lib_tfsample.py for more detail.
      sample_steps: an integer indicating the number of steps to sample in this
          call.  If set to 0, then it defaults to total_gibbs_steps.
      current_step: an integer indicating how many steps might have already
          sampled before.
      total_gibbs_steps: an integer indicating the total number of steps that
          a complete sampling procedure would take.
      temperature: a float indicating the temperature for sampling from softmax.

    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,
                     masks=None,
                     gen_batch_size=3,
                     piece_length=16,
                     sample_steps=0,
                     current_step=0,
                     total_gibbs_steps=0,
                     temperature=0.99):
    """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.
      masks: a 4D numpy array of the same shape as pianorolls, with 1s
          indicating mask out.  If is None, then the masks will be where have 1s
          where there are no notes, indicating to the model they should be
          filled in.
      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.
      See the CoconetSampleGraph class in lib_tfsample.py for more detail.
      sample_steps: an integer indicating the number of steps to sample in this
          call.  If set to 0, then it defaults to total_gibbs_steps.
      current_step: an integer indicating how many steps might have already
          sampled before.
      total_gibbs_steps: an integer indicating the total number of steps that
          a complete sampling procedure would take.
      temperature: a float indicating the temperature for sampling from softmax.

    Returns:
      A list of PrettyMIDI instances, with length gen_batch_size.
    """
    # 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.
    if midi_in is not None:
      pianorolls_in = self.endecoder.encode_midi_to_pianoroll(midi_in, shape)
    elif pianorolls_in is None:
      pianorolls_in = np.zeros(shape, dtype=np.float32)
    results = self.sampler.run(
        pianorolls_in, masks, sample_steps=sample_steps,
        current_step=current_step, total_gibbs_steps=total_gibbs_steps,
        temperature=temperature)
    self._pianorolls = results["pianorolls"]
    self._time_taken = results["time_taken"]
    tf.logging.info("output pianorolls shape: %r", self.pianorolls.shape)
    midi_outs = get_midi_from_pianorolls(self.pianorolls, self.endecoder)
    return midi_outs
def run_generation ( self , midi_in = None , pianorolls_in = None , masks = None , gen_batch_size = 3 , piece_length = 16 , sample_steps = 0 , current_step = 0 , total_gibbs_steps = 0 , temperature = 0.99 ) : # 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. if midi_in is not None : pianorolls_in = self . endecoder . encode_midi_to_pianoroll ( midi_in , shape ) elif pianorolls_in is None : pianorolls_in = np . zeros ( shape , dtype = np . float32 ) results = self . sampler . run ( pianorolls_in , masks , sample_steps = sample_steps , current_step = current_step , total_gibbs_steps = total_gibbs_steps , temperature = temperature ) self . _pianorolls = results [ "pianorolls" ] self . _time_taken = results [ "time_taken" ] tf . logging . info ( "output pianorolls shape: %r" , self . pianorolls . shape ) midi_outs = get_midi_from_pianorolls ( self . pianorolls , self . endecoder ) return midi_outs