Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _dataloader_from_data(self, args, batch_size):
args = numpy_to_torch(args)
dataset = TensorDataset(*args) if len(args) > 1 else args[0]
generator = DataLoader(dataset, batch_size)
return generator
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