(self, sequences=None)
return Batch(pianorolls=pianorolls, masks=masks, lengths=lengths)
Turn sequences into features for training/evaluation.

    Encodes sequences into randomly cropped and masked pianorolls, and returns
    a padded Batch containing three channels: the pianorolls, the corresponding
    masks and their lengths before padding (but after cropping).

    Args:
      sequences: the collection of sequences to convert. If not given, the
          entire dataset is converted.

    Returns:
      A Batch containing pianorolls, masks and piece lengths.
Turn sequences into features for training/evaluation.
Turn sequences into features for training / evaluation .
def get_featuremaps(self, sequences=None):
    """Turn sequences into features for training/evaluation.

    Encodes sequences into randomly cropped and masked pianorolls, and returns
    a padded Batch containing three channels: the pianorolls, the corresponding
    masks and their lengths before padding (but after cropping).

    Args:
      sequences: the collection of sequences to convert. If not given, the
          entire dataset is converted.

    Returns:
      A Batch containing pianorolls, masks and piece lengths.
    """
    if sequences is None:
      sequences = self.get_sequences()

    pianorolls = []
    masks = []

    for sequence in sequences:
      pianoroll = self.encoder.encode(sequence)
      pianoroll = lib_util.random_crop(pianoroll, self.hparams.crop_piece_len)
      mask = lib_mask.get_mask(
          self.hparams.maskout_method,
          pianoroll.shape,
          separate_instruments=self.hparams.separate_instruments,
          blankout_ratio=self.hparams.corrupt_ratio)
      pianorolls.append(pianoroll)
      masks.append(mask)

    (pianorolls, masks), lengths = lib_util.pad_and_stack(pianorolls, masks)
    assert pianorolls.ndim == 4 and masks.ndim == 4
    assert pianorolls.shape == masks.shape
    return Batch(pianorolls=pianorolls, masks=masks, lengths=lengths)
def get_featuremaps ( self , sequences = None ) : if sequences is None : sequences = self . get_sequences ( ) pianorolls = [ ] masks = [ ] for sequence in sequences : pianoroll = self . encoder . encode ( sequence ) pianoroll = lib_util . random_crop ( pianoroll , self . hparams . crop_piece_len ) mask = lib_mask . get_mask ( self . hparams . maskout_method , pianoroll . shape , separate_instruments = self . hparams . separate_instruments , blankout_ratio = self . hparams . corrupt_ratio ) pianorolls . append ( pianoroll ) masks . append ( mask ) ( pianorolls , masks ) , lengths = lib_util . pad_and_stack ( pianorolls , masks ) assert pianorolls . ndim == 4 and masks . ndim == 4 assert pianorolls . shape == masks . shape return Batch ( pianorolls = pianorolls , masks = masks , lengths = lengths )