self.logger = logging.getLogger(self.__class__.__name__)
// setup GPU device if available, move model into configured device
self.with_cuda = config["cuda"] and torch.cuda.is_available()
if config["cuda"] and not torch.cuda.is_available():
self.logger.warning("Warning: There\"s no GPU available on this machine, "
"training will be performed on CPU.")
self.device = torch.device("cuda:" + str(config["gpu"]) if self.with_cuda else "cpu")
self.model = model.to(self.device)
self.loss = loss