(self, basepath, hparams, fold)
Initialize a `Dataset` instance.

    Args:
      basepath: path to directory containing dataset npz files.
      hparams: Hyperparameters object.
      fold: data subset, one of {train,valid,test}.

    Raises:
      ValueError: if requested a temporal resolution shorter then that available
          in the dataset.
Initialize a `Dataset` instance.
Initialize a Dataset instance .
def __init__(self, basepath, hparams, fold):
    """Initialize a `Dataset` instance.

    Args:
      basepath: path to directory containing dataset npz files.
      hparams: Hyperparameters object.
      fold: data subset, one of {train,valid,test}.

    Raises:
      ValueError: if requested a temporal resolution shorter then that available
          in the dataset.
    """
    self.basepath = basepath
    self.hparams = hparams
    self.fold = fold

    if self.shortest_duration != self.hparams.quantization_level:
      raise ValueError("The data has a temporal resolution of shortest "
                       "duration=%r, requested=%r" %
                       (self.shortest_duration,
                        self.hparams.quantization_level))

    # Update the default pitch ranges in hparams to reflect that of dataset.
    hparams.pitch_ranges = [self.min_pitch, self.max_pitch]  # legacy hparam
    hparams.min_pitch = self.min_pitch
    hparams.max_pitch = self.max_pitch
    hparams.shortest_duration = self.shortest_duration
    hparams.dataset = self.key
    self.encoder = lib_pianoroll.get_pianoroll_encoder_decoder(hparams)
    data_path = os.path.join(tf.resource_loader.get_data_files_path(),
                             self.basepath, "%s.npz" % self.name)
    print("Loading data from", data_path)
    with tf.gfile.Open(data_path, "rb") as p:
      self.data = np.load(p, allow_pickle=True, encoding="latin1")[fold]
def __init__ ( self , basepath , hparams , fold ) : self . basepath = basepath self . hparams = hparams self . fold = fold if self . shortest_duration != self . hparams . quantization_level : raise ValueError ( "The data has a temporal resolution of shortest " "duration=%r, requested=%r" % ( self . shortest_duration , self . hparams . quantization_level ) ) # Update the default pitch ranges in hparams to reflect that of dataset. hparams . pitch_ranges = [ self . min_pitch , self . max_pitch ] # legacy hparam hparams . min_pitch = self . min_pitch hparams . max_pitch = self . max_pitch hparams . shortest_duration = self . shortest_duration hparams . dataset = self . key self . encoder = lib_pianoroll . get_pianoroll_encoder_decoder ( hparams ) data_path = os . path . join ( tf . resource_loader . get_data_files_path ( ) , self . basepath , "%s.npz" % self . name ) print ( "Loading data from" , data_path ) with tf . gfile . Open ( data_path , "rb" ) as p : self . data = np . load ( p , allow_pickle = True , encoding = "latin1" ) [ fold ]