Example #1
0
 def _dataloader_from_data(self, *args, batch_size=None):
     assert batch_size is not None, \
         "batch_size should not be None. Please, report this as a bug."
     args = numpy_to_torch(args)
     dataset = TensorDataset(*args) if len(args) > 1 else args[0]
     generator = DataLoader(dataset, batch_size)
     return generator
Example #2
0
 def _process_input(self, *args):
     args = numpy_to_torch(args)
     if self.device is not None:
         args = torch_to(args, self.device)
     return args[0] if len(args) == 1 else args