class_docstr: Class for retrieving different datasets.
class_docstr_tok: ["Class","for","retrieving","different","datasets","."]
docstr: 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.
docstr_tok: ["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","."]
code: 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)
  
imports: import os
  from magenta.models.coconet import lib_mask
  from magenta.models.coconet import lib_pianoroll
  from magenta.models.coconet import lib_util
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 7 for calling the Dataset obj's underlying member method code with example usage: obj.get_featuremaps(sequences) and returns: Batch